本文整理汇总了PHP中ExtraFieldValue类的典型用法代码示例。如果您正苦于以下问题:PHP ExtraFieldValue类的具体用法?PHP ExtraFieldValue怎么用?PHP ExtraFieldValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ExtraFieldValue类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: editQuestionAction
/**
* Edits a question for the question manager
*
* @param Application $app
* @param int $id
* @return Response
*/
public function editQuestionAction(Application $app, $id)
{
$extraJS = array();
//@todo improve this JS includes should be added using twig
$extraJS[] = '<link href="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/tag/style.css" rel="stylesheet" type="text/css" />';
$extraJS[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/tag/jquery.fcbkcomplete.js" type="text/javascript" language="javascript"></script>';
$app['extraJS'] = $extraJS;
// Setting exercise obj.
$exercise = new \Exercise();
$exercise->edit_exercise_in_lp = true;
// Setting question obj.
/** @var \Question $question */
$question = \Question::read($id, null, $exercise);
$question->submitClass = "btn save";
$question->submitText = get_lang('ModifyQuestion');
$question->setDefaultValues = true;
// Generating edit URL.
$url = $app['url_generator']->generate('admin_questions_edit', array('id' => $id));
// Creating a new form
$form = new \FormValidator('edit_question', 'post', $url);
$extraFields = new \ExtraField('question');
$extraFields->addElements($form, $id);
// Validating if there are extra fields to modify.
if (count($form->_elements) > 1) {
$form->addElement('button', 'submit', get_lang('Update'));
$app['template']->assign('question', $question);
$app['template']->assign('form', $form->toHtml());
} else {
$app['template']->assign('message', \Display::return_message(get_lang('ThereAreNotExtrafieldsAvailable'), 'warning'));
}
// If form was submitted.
if ($form->validate()) {
$field_value = new \ExtraFieldValue('question');
$params = $form->exportValues();
$params['question_id'] = $id;
$field_value->save_field_values($params);
$app['template']->assign('message', \Display::return_message(get_lang('ItemUpdated'), 'success'));
$url = $app['url_generator']->generate('admin_questions_edit', array('id' => $id));
return $app->redirect($url);
}
$response = $app['template']->render_template('admin/questionmanager/edit_question.tpl');
return new Response($response, 200, array());
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:50,代码来源:QuestionManagerController.php
示例2: editQuestionAction
/**
* Edits a question for the question manager
*
* @Route("/edit")
* @Method({"GET"})
* @param int $id
* @return Response
*/
public function editQuestionAction($id)
{
// Setting exercise obj.
$exercise = new \Exercise();
$exercise->edit_exercise_in_lp = true;
// Setting question obj.
/** @var \Question $question */
$question = \Question::read($id, null, $exercise);
$question->submitClass = "btn save";
$question->submitText = get_lang('ModifyQuestion');
$question->setDefaultValues = true;
// Generating edit URL.
$url = $this->generateControllerUrl('editQuestionAction', array('id' => $id));
// Creating a new form
$form = new \FormValidator('edit_question', 'post', $url);
$extraFields = new \ExtraField('question');
$extraFields->addElements($form, $id);
// Validating if there are extra fields to modify.
if (count($form->_elements) > 1) {
$form->addElement('button', 'submit', get_lang('Update'));
$this->getTemplate()->assign('question', $question);
$this->getTemplate()->assign('form', $form->toHtml());
} else {
$this->addFlash('warning', get_lang('ThereAreNotExtrafieldsAvailable'));
}
// If form was submitted.
if ($form->validate()) {
$field_value = new \ExtraFieldValue('question');
$params = $form->exportValues();
$params['question_id'] = $id;
$field_value->save_field_values($params);
$this->addFlash('success', get_lang('ItemUpdated'));
$url = $this->generateControllerUrl('editQuestionAction', array('id' => $id));
return $this->redirect($url);
}
$response = $this->renderTemplate('edit_question.tpl');
return new Response($response, 200, array());
}
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:46,代码来源:QuestionManagerController.php
示例3: api_check_term_condition
/**
* Checks whether we already approved the last version term and condition
* @param int user id
* @return bool true if we pass false otherwise
*/
function api_check_term_condition($user_id)
{
if (api_get_setting('registration.allow_terms_conditions') == 'true') {
//check if exists terms and conditions
if (LegalManager::count() == 0) {
return true;
}
$extraFieldValue = new ExtraFieldValue('user');
$data = $extraFieldValue->get_values_by_handler_and_field_variable($user_id, 'legal_accept');
if (!empty($data) && isset($data['value'])) {
$rowv = $data['value'];
$user_conditions = explode(':', $rowv);
$version = $user_conditions[0];
$lang_id = $user_conditions[1];
$real_version = LegalManager::get_last_version($lang_id);
return $version >= $real_version;
}
return false;
}
return false;
}
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:26,代码来源:api.lib.php
示例4: generateProfileEditingURL
/**
* Generate the URL for profile editing for a any user or the current user
* @param int $userId Optional. The user id
* @param boolean $asAdmin Optional. Whether get the URL for the platform admin
* @return string If the URL is obtained return the drupal_user_id. Otherwise return false
*/
public function generateProfileEditingURL($userId = 0, $asAdmin = false)
{
$userId = intval($userId);
if (empty($userId)) {
$userId = api_get_user_id();
}
$userExtraFieldValue = new ExtraFieldValue('user');
$drupalUserIdData = $userExtraFieldValue->get_values_by_handler_and_field_variable($userId, 'drupal_user_id');
// If this is an administrator, allow him to make some changes in
// the Chamilo profile
if ($asAdmin && api_is_platform_admin(true)) {
return api_get_path(WEB_CODE_PATH) . "admin/user_edit.php?user_id={$userId}";
}
// If the user doesn't match a Drupal user, give the normal profile
// link
if ($drupalUserIdData === false) {
return api_get_path(WEB_CODE_PATH) . 'auth/profile.php';
}
// In all other cases, generate a link to the Drupal profile edition
$drupalUserId = $drupalUserIdData['value'];
$url = "{$this->protocol}{$this->domain}/user/{$drupalUserId}/edit";
return $url;
}
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:29,代码来源:sso.Drupal.class.php
示例5: api_get_user_id
if (isset($fields[$sessionFieldValue['field_id']])) {
$var = $fields[$sessionFieldValue['field_id']];
$val = $sessionFieldValue['value'];
// Assign session field value to session
$sessionArray[$var] = $val;
}
}
$adminsArray = UserManager::get_all_administrators();
$data['action'] = 'confirm';
$data['sessionId'] = $sessionId;
$data['currentUserId'] = api_get_user_id();
$isWesternNameOrder = api_is_western_name_order();
foreach ($studentList['students'] as &$student) {
$studentId = intval($student['user_id']);
$data['studentUserId'] = $studentId;
$fieldValue = new ExtraFieldValue('user');
$areaField = $fieldValue->get_values_by_handler_and_field_variable($studentId, 'area', true);
$student['area'] = $areaField['value'];
$student['userLink'] = api_get_path(WEB_CODE_PATH) . 'social/profile.php?u=' . $studentId;
$data['queueId'] = intval($student['queue_id']);
$data['newStatus'] = ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED;
$data['profile_completed'] = 100;
$student['acceptUrl'] = $plugin->getQueueUrl($data);
$data['newStatus'] = ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_DISAPPROVED;
$student['rejectUrl'] = $plugin->getQueueUrl($data);
$student['complete_name'] = $isWesternNameOrder ? $student['firstname'] . ', ' . $student['lastname'] : $student['lastname'] . ', ' . $student['firstname'];
}
$tpl->assign('session', $sessionArray);
$tpl->assign('students', $studentList['students']);
}
// Assign variables
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:admin_view.php
示例6: get_user_data
/**
* Get the users to display on the current page.
*/
function get_user_data($from, $number_of_items, $column, $direction)
{
global $is_western_name_order;
global $extraFields;
$type = isset($_REQUEST['type']) ? intval($_REQUEST['type']) : STUDENT;
$course_info = api_get_course_info();
$sessionId = api_get_session_id();
$course_code = $course_info['code'];
$a_users = array();
// limit
if (!isset($_GET['keyword']) || empty($_GET['keyword'])) {
$limit = 'LIMIT ' . intval($from) . ',' . intval($number_of_items);
}
if (!in_array($direction, array('ASC', 'DESC'))) {
$direction = 'ASC';
}
switch ($column) {
case 2:
//official code
$order_by = 'ORDER BY user.official_code ' . $direction;
break;
case 3:
if ($is_western_name_order) {
$order_by = 'ORDER BY user.firstname ' . $direction . ', user.lastname ' . $direction;
} else {
$order_by = 'ORDER BY user.lastname ' . $direction . ', user.firstname ' . $direction;
}
break;
case 4:
if ($is_western_name_order) {
$order_by = 'ORDER BY user.lastname ' . $direction . ', user.firstname ' . $direction;
} else {
$order_by = 'ORDER BY user.firstname ' . $direction . ', user.lastname ' . $direction;
}
break;
case 5:
//username
$order_by = 'ORDER BY user.username ' . $direction;
break;
default:
if ($is_western_name_order) {
$order_by = 'ORDER BY user.lastname ' . $direction . ', user.firstname ' . $direction;
} else {
$order_by = 'ORDER BY user.firstname ' . $direction . ', user.lastname ' . $direction;
}
break;
}
$active = isset($_GET['active']) ? $_GET['active'] : null;
if (empty($sessionId)) {
$status = $type;
} else {
if ($type == COURSEMANAGER) {
$status = 2;
} else {
$status = 0;
}
}
$a_course_users = CourseManager::get_user_list_from_course_code($course_code, $sessionId, $limit, $order_by, $status, null, false, false, null, array(), array(), $active);
foreach ($a_course_users as $user_id => $o_course_user) {
if (isset($_GET['keyword']) && searchUserKeyword($o_course_user['firstname'], $o_course_user['lastname'], $o_course_user['username'], $o_course_user['official_code'], $_GET['keyword']) || !isset($_GET['keyword']) || empty($_GET['keyword'])) {
$groupsNameList = GroupManager::getAllGroupPerUserSubscription($user_id);
$groupsNameListParsed = [];
if (!empty($groupsNameList)) {
$groupsNameListParsed = array_column($groupsNameList, 'name');
}
$temp = array();
if (api_is_allowed_to_edit(null, true)) {
$userInfo = api_get_user_info($user_id);
$photo = '<img src="' . $userInfo['avatar_small'] . '" alt="' . $userInfo['complete_name'] . '" title="' . $userInfo['complete_name'] . '" />';
$temp[] = $user_id;
$temp[] = $photo;
$temp[] = $o_course_user['official_code'];
if ($is_western_name_order) {
$temp[] = $o_course_user['firstname'];
$temp[] = $o_course_user['lastname'];
} else {
$temp[] = $o_course_user['lastname'];
$temp[] = $o_course_user['firstname'];
}
$temp[] = $o_course_user['username'];
// Groups.
$temp[] = implode(', ', $groupsNameListParsed);
// Status
$default_status = get_lang('Student');
if (isset($o_course_user['status_rel']) && $o_course_user['status_rel'] == 1 || isset($o_course_user['status_session']) && $o_course_user['status_session'] == 2) {
$default_status = get_lang('CourseManager');
} elseif (isset($o_course_user['is_tutor']) && $o_course_user['is_tutor'] == 1) {
$default_status = get_lang('Tutor');
}
$temp[] = $default_status;
// Active
$temp[] = $o_course_user['active'];
if (!empty($extraFields)) {
foreach ($extraFields as $extraField) {
$extraFieldValue = new ExtraFieldValue('user');
$data = $extraFieldValue->get_values_by_handler_and_field_id($user_id, $extraField['id']);
$temp[] = $data['value'];
//.........这里部分代码省略.........
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:101,代码来源:user.php
示例7: WSDeleteSession
function WSDeleteSession($params)
{
if (!WSHelperVerifyKey($params)) {
return return_error(WS_ERROR_SECRET_KEY);
}
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$session_params = $params['sessions'];
$results = array();
$orig_session_id_value = array();
foreach ($session_params as $session_param) {
$original_session_id_value = $session_param['original_session_id_value'];
$original_session_id_name = $session_param['original_session_id_name'];
$orig_session_id_value[] = $original_session_id_name;
$idChecked = SessionManager::getSessionIdFromOriginalId($original_session_id_value, $original_session_id_name);
if (empty($idChecked)) {
$results[] = 0;
continue;
}
$session_ids[] = $idChecked;
$sql = "DELETE FROM {$tbl_session} WHERE id = '{$idChecked}'";
Database::query($sql);
$sql = "DELETE FROM {$tbl_session_rel_course} WHERE session_id = '{$idChecked}'";
Database::query($sql);
$sql = "DELETE FROM {$tbl_session_rel_course_rel_user} WHERE session_id = '{$idChecked}'";
Database::query($sql);
$sql = "DELETE FROM {$tbl_session_rel_user} WHERE session_id = '{$idChecked}'";
Database::query($sql);
$results[] = 1;
continue;
}
$extraFieldValue = new ExtraFieldValue('session');
//delete from table_session_field_value from a given session_id
foreach ($session_ids as $session_id) {
$extraFieldValue->deleteValuesByItem($session_id);
}
// Preparing output.
$count_results = count($results);
$output = array();
for ($i = 0; $i < $count_results; $i++) {
$output[] = array('original_session_id_value' => $orig_session_id_value[$i], 'result' => $results[$i]);
}
return $output;
}
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:47,代码来源:registration.soap.php
示例8: getCourseInfoFromOriginalId
/**
* Get the course id based on the original id and field name in the extra fields.
* Returns 0 if course was not found
*
* @param string $value Original course code
* @param string $variable Original field name
* @return int Course id
*/
public static function getCourseInfoFromOriginalId($value, $variable)
{
$extraFieldValue = new ExtraFieldValue('course');
$result = $extraFieldValue->get_item_id_from_field_variable_and_field_value($variable, $value);
if (!empty($result)) {
$courseInfo = api_get_course_info_by_id($result['item_id']);
return $courseInfo;
}
return 0;
}
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:18,代码来源:course.lib.php
示例9: execute_field_match
/**
* Executes a fields match
* @param array List of fields that must be matched ('fields_match' => array(0=>array('orig'=>'...','dest'=>'...',...)))
* @param array Row of data
* @param array Extra fields table definition
*/
function execute_field_match($table, $row, $extra_fields = array())
{
//error_log('execute_field_match');
$dest_row = array();
$first_field = '';
// If a dest table has been defined, fill $my_extra_fields with the
// extra_fields defined for that table
$my_extra_fields = isset($table['dest_table']) && isset($extra_fields[$table['dest_table']]) ? $extra_fields[$table['dest_table']] : null;
$extra_field_obj = null;
$extra_field_value_obj = null;
if (!empty($table['dest_table'])) {
$extra_field_obj = new ExtraField($table['dest_table']);
$extra_field_value_obj = new ExtraFieldValue($table['dest_table']);
}
$extra_fields_to_insert = array();
global $data_list;
// Fill the data list, if possible
if (count($data_list['users']) < 1) {
MigrationCustom::fill_data_list($data_list);
}
foreach ($table['fields_match'] as $id_field => $details) {
//if ($table['dest_table'] == 'session') {error_log('Processing field '.$details['orig']);}
$params = array();
// Remove the table name prefix if any (in the orig field)
if (isset($details['orig'])) {
$field_exploded = explode('.', $details['orig']);
if (isset($field_exploded[1])) {
$details['orig'] = $field_exploded[1];
}
}
// process the fields one by one
if ($details['func'] == 'none' || empty($details['func'])) {
// if no function is defined to alter the field, take it as is
$dest_data = $row[$details['orig']];
} else {
// if an alteration function is defined, run it on the field
//error_log(__FILE__.' '.__LINE__.' Preparing to treat field with '.$details['func']);
$dest_data = MigrationCustom::$details['func']($row[$details['orig']], $data_list, $row);
}
if (isset($dest_row[$details['dest']])) {
$dest_row[$details['dest']] .= ' ' . $dest_data;
} else {
$dest_row[$details['dest']] = $dest_data;
}
//Extra field values
$extra_field = isset($my_extra_fields) && isset($my_extra_fields[$details['dest']]) ? $my_extra_fields[$details['dest']] : null;
// Check the array is there
//if($table['dest_table'] == 'session') error_log('Extra field: '.print_r($extra_field,1));
if (!empty($extra_field) && $extra_field_obj) {
//if($table['dest_table'] == 'session') error_log('Extra_field no es vacío');
// Check the "options" array is defined for this field (checking is_array is crucial here, see BT#5215)
if (is_array($extra_field['options']) && count($extra_field['options']) > 0) {
//if($table['dest_table'] == 'session') error_log('...y sus opciones son: '.print_r($extra_field['options'],1));
//if($details['orig']=='uidIdPrograma') { error_log('Eso era lo inicial, del cual se tomó '.$details['dest'].': '.print_r($my_extra_fields,1));}
$options = $extra_field['options'];
$field_type = $extra_field['field_type'];
//if ($table['dest_table'] == 'session') {error_log('Field orig: '.$details['orig']);}
if (!empty($options)) {
//if ($table['dest_table'] == 'session') {error_log('Options not empty');}
if (!is_array($options)) {
$options = array($options);
}
foreach ($options as $option) {
if (is_array($option)) {
foreach ($option as $key => $value) {
//error_log("$key $value --> {$dest_row[$details['dest']]} ");
if ($key == 'option_value' && $value == $dest_row[$details['dest']]) {
$value = $option['option_display_text'];
if ($field_type == Extrafield::FIELD_TYPE_SELECT) {
$value = $option['option_value'];
}
$params = array('field_id' => $option['field_id'], 'field_value' => $value);
break 2;
}
}
}
}
}
} else {
$params = array('field_id' => $extra_field, 'field_value' => $dest_row[$details['dest']]);
}
if (!empty($params)) {
$extra_fields_to_insert[] = $params;
}
unset($dest_row[$details['dest']]);
}
unset($extra_field);
}
//if ($table['dest_table']=='session') { error_log('Params: '.print_r($params,1)); }
// If a dest_func entry has been defind, use this entry as the main
// operation to execute when inserting the item
if (!empty($table['dest_func'])) {
//error_log('Calling '.$table['dest_func'].' on data recovered: '.print_r($dest_row, 1));
$dest_row['return_item_if_already_exists'] = true;
//.........这里部分代码省略.........
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:101,代码来源:migration.class.php
示例10: get_horario_value
static function get_horario_value($session_id)
{
$extra_field_value = new ExtraFieldValue('session');
//Getting horario info
$extra_field = new ExtraField('session');
$extra_field_info = $extra_field->get_handler_field_info_by_field_variable('horario');
$horario_info = $extra_field_value->get_values_by_handler_and_field_id($session_id, $extra_field_info['id']);
$extra_field_option = new ExtraFieldOption('session');
$horario_info = $extra_field_option->get_field_option_by_field_and_option($extra_field_info['id'], $horario_info['field_value']);
$time = "08:00";
if (isset($horario_info) && isset($horario_info[0])) {
$horario = $horario_info[0]['option_display_text'];
$horario_array = explode(' ', $horario);
//Schedule format is "(01) 07:00 09:00" in this case. Adapt to your case
if (isset($horario_array[1])) {
$time = $horario_array[1];
}
}
return $time;
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:20,代码来源:migration.custom.class.php
示例11: getQuestionListPagination
/**
*
* @param int $start
* @param int $limit
* @param int $sidx
* @param string $sord
* @param array $where_condition
* @param array $extraFields
*/
public function getQuestionListPagination($start, $limit, $sidx, $sord, $where_condition = array(), $extraFields = array())
{
if (!empty($this->id)) {
$category_list = TestCategory::getListOfCategoriesNameForTest($this->id, false);
$TBL_EXERCICE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
$TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION);
$sql = "SELECT q.iid\n FROM {$TBL_EXERCICE_QUESTION} e INNER JOIN {$TBL_QUESTIONS} q\n ON (e.question_id = q.iid AND e.c_id = " . $this->course_id . " )\n\t\t\t\t\tWHERE e.exercice_id\t= '" . Database::escape_string($this->id) . "'\n\t\t\t\t\t";
$orderCondition = "ORDER BY question_order";
if (!empty($sidx) && !empty($sord)) {
if ($sidx == 'question') {
if (in_array(strtolower($sord), array('desc', 'asc'))) {
$orderCondition = " ORDER BY q.{$sidx} {$sord}";
}
}
}
$sql .= $orderCondition;
$limitCondition = null;
if (isset($start) && isset($limit)) {
$start = intval($start);
$limit = intval($limit);
$limitCondition = " LIMIT {$start}, {$limit}";
}
$sql .= $limitCondition;
$result = Database::query($sql);
$questions = array();
if (Database::num_rows($result)) {
if (!empty($extraFields)) {
$extraFieldValue = new ExtraFieldValue('question');
}
while ($question = Database::fetch_array($result, 'ASSOC')) {
/** @var Question $objQuestionTmp */
$objQuestionTmp = Question::read($question['iid']);
$category_labels = TestCategory::return_category_labels($objQuestionTmp->category_list, $category_list);
if (empty($category_labels)) {
$category_labels = "-";
}
// Question type
list($typeImg, $typeExpl) = $objQuestionTmp->get_type_icon_html();
$question_media = null;
if (!empty($objQuestionTmp->parent_id)) {
$objQuestionMedia = Question::read($objQuestionTmp->parent_id);
$question_media = Question::getMediaLabel($objQuestionMedia->question);
}
$questionType = Display::tag('div', Display::return_icon($typeImg, $typeExpl, array(), ICON_SIZE_MEDIUM) . $question_media);
$question = array('id' => $question['iid'], 'question' => $objQuestionTmp->selectTitle(), 'type' => $questionType, 'category' => Display::tag('div', '<a href="#" style="padding:0px; margin:0px;">' . $category_labels . '</a>'), 'score' => $objQuestionTmp->selectWeighting(), 'level' => $objQuestionTmp->level);
if (!empty($extraFields)) {
foreach ($extraFields as $extraField) {
$value = $extraFieldValue->get_values_by_handler_and_field_id($question['id'], $extraField['id']);
$stringValue = null;
if ($value) {
$stringValue = $value['field_value'];
}
$question[$extraField['field_variable']] = $stringValue;
}
}
$questions[] = $question;
}
}
return $questions;
}
}
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:70,代码来源:exercise.class.php
示例12: array
$hash = Security::remove_XSS($_REQUEST['v']);
// Get data from request (GET or POST)
$data['action'] = 'confirm';
$data['currentUserId'] = 1;
$data['queueId'] = 0;
$data['is_connected'] = true;
$data['profile_completed'] = 90.0;
// Init result array
$data['sessionId'] = 1;
$data['studentUserId'] = 4;
// Prepare data
// Get session data
// Assign variables
$fieldsArray = array('description', 'target', 'mode', 'publication_end_date', 'recommended_number_of_participants');
$sessionArray = api_get_session_info($data['sessionId']);
$extraSession = new ExtraFieldValue('session');
$extraField = new ExtraField('session');
// Get session fields
$fieldList = $extraField->get_all(array('variable IN ( ?, ?, ?, ?, ?)' => $fieldsArray));
$fields = array();
// Index session fields
foreach ($fieldList as $field) {
$fields[$field['id']] = $field['variable'];
}
$mergedArray = array_merge(array($data['sessionId']), array_keys($fields));
$sessionFieldValueList = $extraSession->get_all(array('item_id = ? field_id IN ( ?, ?, ?, ?, ?, ?, ? )' => $mergedArray));
foreach ($sessionFieldValueList as $sessionFieldValue) {
// Check if session field value is set in session field list
if (isset($fields[$sessionFieldValue['field_id']])) {
$var = $fields[$sessionFieldValue['field_id']];
$val = $sessionFieldValue['value'];
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:mails.php
示例13: get_user_data
//.........这里部分代码省略.........
if (api_is_allowed_to_edit(null, true)) {
$temp[] = $user_id;
$image_path = UserManager::get_user_picture_path_by_id(
$user_id,
'web',
false,
true
);
$user_profile = UserManager::get_picture_user(
$user_id,
$image_path['file'],
22,
USER_IMAGE_SIZE_SMALL,
' width="22" height="22" '
);
if (!api_is_anonymous()) {
$photo = '<a href="userInfo.php?'.api_get_cidreq().'&origin='.$origin.'&uInfo='.$user_id.'" title="'.get_lang('Info').'" ><img src="'.$user_profile['file'].'" '.$user_profile['style'].' alt="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" title="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" /></a>';
} else {
$photo = '<img src="'.$user_profile['file'].'" '.$user_profile['style'].' alt="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" title="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" />';
}
$temp[] = $photo;
$temp[] = $o_course_user['official_code'];
if ($is_western_name_order) {
$temp[] = $o_course_user['firstname'];
$temp[] = $o_course_user['lastname'];
} else {
$temp[] = $o_course_user['lastname'];
$temp[] = $o_course_user['firstname'];
}
$temp[] = $o_course_user['username'];
// Description.
$temp[] = isset($o_course_user['role']) ? $o_course_user['role'] : null;
// Groups.
$temp[] = implode(', ', $groupsNameList);
// Status
$default_status = '-';
if ((isset($o_course_user['status_rel']) && $o_course_user['status_rel'] == 1) ||
(isset($o_course_user['status_session']) && $o_course_user['status_session'] == 2)
) {
$default_status = get_lang('CourseManager');
} elseif (isset($o_course_user['tutor_id']) && $o_course_user['tutor_id'] == 1) {
$default_status = get_lang('Tutor');
}
$temp[] = $default_status;
// Active
$temp[] = $o_course_user['active'];
if (!empty($extraFields)) {
foreach ($extraFields as $extraField) {
$extraFieldValue = new ExtraFieldValue('user');
$data = $extraFieldValue->get_values_by_handler_and_field_id(
$user_id,
$extraField['id']
);
$temp[] = $data['field_value'];
}
}
// User id for actions
$temp[] = $user_id;
} else {
$image_path = UserManager::get_user_picture_path_by_id($user_id, 'web', false, true);
$image_repository = $image_path['dir'];
$existing_image = $image_path['file'];
if (!api_is_anonymous()) {
$photo= '<a href="userInfo.php?'.api_get_cidreq().'&origin='.$origin.'&uInfo='.$user_id.'" title="'.get_lang('Info').'" ><img src="'.$image_repository.$existing_image.'" alt="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" width="22" height="22" title="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" /></a>';
} else {
$photo= '<img src="'.$image_repository.$existing_image.'" alt="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" width="22" height="22" title="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" />';
}
$temp[] = $user_id;
$temp[] = $photo;
$temp[] = $o_course_user['official_code'];
if ($is_western_name_order) {
$temp[] = $o_course_user['firstname'];
$temp[] = $o_course_user['lastname'];
} else {
$temp[] = $o_course_user['lastname'];
$temp[] = $o_course_user['firstname'];
}
$temp[] = $o_course_user['username'];
$temp[] = $o_course_user['role'];
// Group.
$temp[] = implode(', ', $groupsNameList);
if ($course_info['unsubscribe'] == 1) {
//User id for actions
$temp[] = $user_id;
}
}
$a_users[$user_id] = $temp;
}
}
return $a_users;
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:101,代码来源:user.php
示例14: api_not_allowed
<?php
/* For licensing terms, see /license.txt */
/**
* Session view
* @package chamilo.session
* @author Julio Montoya <[email protected]> Beeznest
*/
use ChamiloSession as Session;
$cidReset = true;
//require_once '../inc/global.inc.php';
if (empty($_GET['session_id'])) {
api_not_allowed();
}
$session_id = isset($_GET['session_id']) ? intval($_GET['session_id']) : null;
$sessionField = new ExtraFieldValue('session');
$valueAllowVisitors = $sessionField->get_values_by_handler_and_field_variable($session_id, 'allow_visitors');
$allowVisitors = $valueAllowVisitors != false;
if (!$allowVisitors) {
// Only users who are logged in can proceed.
api_block_anonymous_users();
}
$this_section = SECTION_COURSES;
$htmlHeadXtra[] = api_get_jqgrid_js();
$course_id = isset($_GET['course_id']) ? intval($_GET['course_id']) : null;
Session::write('id_session', $session_id);
// Clear the exercise session just in case
Session::erase('objExercise');
$userId = api_get_user_id();
$session_info = SessionManager::fetch($session_id);
$session_list = SessionManager::get_sessions_by_coach(api_get_user_id());
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:index.php
示例15: update
/**
* Updates a course with the given array of attributes
* @param array Array of attributes
* @return array Array of course attributes
* @assert () === false
*/
public static function update($params)
{
if (!is_array($params) or count($params) < 1) {
return false;
}
$course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$course_table = Database::get_main_table(TABLE_MAIN_COURSE);
$course_code = $params['code'];
$courseInfo = api_get_course_info($course_code);
$visual_code = $params['visual_code'];
$field_value = new ExtraFieldValue('course');
$params['course_code'] = $course_code;
$field_value->save_field_values($params);
/*$tutor_id = $params['tutor_name'];
$tutor_name=$platform_teachers[$tutor_id];*/
$teachers = $params['group']['course_teachers'];
$title = $params['title'];
$category_code = $params['category_code'];
$department_name = $params['department_name'];
$department_url = $params['department_url'];
$course_language = $params['course_language'];
$course['disk_quota'] = $params['disk_quota'] * 1024 * 1024;
$disk_quota = $params['disk_quota'];
$visibility = $params['visibility'];
$subscribe = $params['subscribe'];
$unsubscribe = $params['unsubscribe'];
if (!stristr($department_url, 'http://')) {
$department_url = 'http://' . $department_url;
}
//tutor_name='".Database::escape_string($tutor_name)."',
$sql = "UPDATE {$course_table} SET\n course_language='" . Database::escape_string($course_language) . "',\n title='" . Database::escape_string($title) . "',\n category_code='" . Database::escape_string($category_code) . "',\n visual_code='" . Database::escape_string($visual_code) . "',\n department_name='" . Database::escape_string($department_name) . "',\n department_url='" . Database::escape_string($department_url) . "',\n disk_quota='" . Database::escape_string($disk_quota) . "',\n visibility = '" . Database::escape_string($visibility) . "',\n subscribe = '" . Database::escape_string($subscribe) . "',\n unsubscribe='" . Database::escape_string($unsubscribe) . "'\n WHERE code='" . Database::escape_string($course_code) . "'";
Database::query($sql);
//Delete only teacher relations that doesn't match the selected teachers
$cond = '';
if (count($teachers) > 0) {
foreach ($teachers as $key) {
$cond .= " AND user_id<>'" . $key . "'";
}
}
$sql = 'DELETE FROM ' . $course_user_table . ' WHERE c_id = "' . Database::escape_string($courseInfo['real_id']) . '" AND status="1"' . $cond;
Database::query($sql);
if (count($teachers) > 0) {
foreach ($teachers as $key) {
//We check if the teacher is already subscribed in this course
$sql_select_teacher = 'SELECT 1 FROM ' . $course_user_table . ' WHERE user_id = "' . $key . '" AND c_id = "' . $courseInfo['real_id'] . '" ';
$result = Database::query($sql_select_teacher);
if (Database::num_rows($result) == 1) {
$sql = 'UPDATE ' . $course_user_table . ' SET status = "1" WHERE c_id = "' . $courseInfo['real_id'] . '" AND user_id = "' . $key . '" ';
} else {
$sql = "INSERT INTO " . $course_user_table . " SET\n c_id = '" . Database::escape_string($courseInfo['real_id']) . "',\n user_id = '" . $key . "',\n status = '1',\n role = '',\n tutor_id = '0',\n sort = '0',\n user_course_cat = '0'";
}
Database::query($sql);
}
}
//user_id = '".$tutor_id . "',
$sql = "INSERT IGNORE INTO " . $course_user_table . " SET\n course_code = '" . Database::escape_string($course_code) . "',\n status = '1',\n role = '',\n tutor_id='0',\n sort='0',\n user_course_cat='0'";
Database::query($sql);
$course_info = api_get_course_info($course_code);
return $course_info;
}
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:66,代码来源:course.lib.php
示例16: generateProfileEditingURL
/**
* Generate the URL for profile editing
* @return string If the URL is obtained return the drupal_user_id. Otherwise return false
*/
public function generateProfileEditingURL()
{
$userId = api_get_user_id();
$userExtraFieldValue = new ExtraFieldValue('user');
$drupalUserIdData = $userExtraFieldValue->get_values_by_handler_and_field_variable($userId, 'drupal_user_id');
if ($drupalUserIdData === false) {
return false;
}
$drupalUserId = $drupalUserIdData['field_value'];
$url = "{$this->protocol}{$this->domain}/user/{$drupalUserId}/edit";
return $url;
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:16,代码来源:sso.Drupal.class.php
示例17: isset
$subscribe = $course['subscribe'];
$unsubscribe = isset($course['unsubscribe']) ? $course['unsubscribe'] : '';
$course['course_code'] = $course_code;
if (!stristr($department_url, 'http://')) {
$department_url = 'http://' . $department_url;
}
$manager = Database::getManager();
$courseObj = $manager->getRepository('ChamiloCoreBundle:Course')->find($courseId);
if ($courseObj) {
$url = $manager->getRepository('ChamiloCoreBundle:AccessUrl')->find(api_get_current_access_url_id());
$courseObj->setTitle($title)->setCourseLanguage($course_language)->setCategoryCode($category_code)->setVisualCode($visual_code)->setDepartmentName($department
|
请发表评论