当前位置: 首页>>代码示例>>PHP>>正文


PHP UserManager::get_extra_user_data方法代码示例

本文整理汇总了PHP中UserManager::get_extra_user_data方法的典型用法代码示例。如果您正苦于以下问题:PHP UserManager::get_extra_user_data方法的具体用法?PHP UserManager::get_extra_user_data怎么用?PHP UserManager::get_extra_user_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserManager的用法示例。


在下文中一共展示了UserManager::get_extra_user_data方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_all_info_to_certificate

 /**
  * Return all content to replace and all content to be replace
  * @param int $user_id
  * @param int $course_id
  * @param bool $is_preview
  * @return array
  */
 static function get_all_info_to_certificate($user_id, $course_id, $is_preview = false)
 {
     $info_list = array();
     $user_id = intval($user_id);
     $course_info = api_get_course_info($course_id);
     //info portal
     $organization_name = api_get_setting('platform.institution');
     $portal_name = api_get_setting('platform.site_name');
     // Extra user data information
     $extra_user_info_data = UserManager::get_extra_user_data($user_id, false, false, false, true);
     // get extra fields
     $extraField = new ExtraField('user');
     $extraFields = $extraField->get_all(['filter = ? AND visible = ?' => [1, 1]]);
     //Student information
     $user_info = api_get_user_info($user_id);
     $first_name = $user_info['firstname'];
     $last_name = $user_info['lastname'];
     $official_code = $user_info['official_code'];
     //Teacher information
     $info_teacher_id = UserManager::get_user_id_of_course_admin_or_session_admin($course_info);
     $teacher_info = api_get_user_info($info_teacher_id);
     $teacher_first_name = $teacher_info['firstname'];
     $teacher_last_name = $teacher_info['lastname'];
     // info gradebook certificate
     $info_grade_certificate = UserManager::get_info_gradebook_certificate($course_id, $user_id);
     $date_certificate = $info_grade_certificate['created_at'];
     $date_long_certificate = '';
     $date_no_time = api_convert_and_format_date(api_get_utc_datetime(), DATE_FORMAT_LONG_NO_DAY);
     if (!empty($date_certificate)) {
         $date_long_certificate = api_convert_and_format_date($date_certificate);
         $date_no_time = api_convert_and_format_date($date_certificate, DATE_FORMAT_LONG_NO_DAY);
     }
     if ($is_preview) {
         $date_long_certificate = api_convert_and_format_date(api_get_utc_datetime());
         $date_no_time = api_convert_and_format_date(api_get_utc_datetime(), DATE_FORMAT_LONG_NO_DAY);
     }
     $url = api_get_path(WEB_PATH) . 'certificates/index.php?id=' . $info_grade_certificate['id'];
     //replace content
     $info_to_replace_in_content_html = array($first_name, $last_name, $organization_name, $portal_name, $teacher_first_name, $teacher_last_name, $official_code, $date_long_certificate, $date_no_time, $course_id, $course_info['name'], $info_grade_certificate['grade'], $url, '<a href="' . $url . '" target="_blank">' . get_lang('CertificateOnlineLink') . '</a>', '((certificate_barcode))');
     $info_to_be_replaced_in_content_html = array('((user_firstname))', '((user_lastname))', '((gradebook_institution))', '((gradebook_sitename))', '((teacher_firstname))', '((teacher_lastname))', '((official_code))', '((date_certificate))', '((date_certificate_no_time))', '((course_code))', '((course_title))', '((gradebook_grade))', '((certificate_link))', '((certificate_link_html))', '((certificate_barcode))');
     if (!empty($extraFields)) {
         foreach ($extraFields as $extraField) {
             $valueExtra = isset($extra_user_info_data[$extraField['variable']]) ? $extra_user_info_data[$extraField['variable']] : '';
             $info_to_be_replaced_in_content_html[] = '((' . strtolower($extraField['variable']) . '))';
             $info_to_replace_in_content_html[] = $valueExtra;
         }
     }
     $info_list[] = $info_to_be_replaced_in_content_html;
     $info_list[] = $info_to_replace_in_content_html;
     return $info_list;
 }
开发者ID:daffef,项目名称:chamilo-lms,代码行数:58,代码来源:document.lib.php

示例2: make_field_list

 /**
  * Creates a multi array with the user fields that we can show. We look the visibility with the api_get_setting function
  * The username is always NOT able to change it.
  * @author Julio Montoya Armas <gugli100@gmail.com>, Chamilo: Personality Test modification
  * @return array[value_name][name]
  *            array[value_name][visibilty]
  */
 static function make_field_list()
 {
     //	LAST NAME and FIRST NAME
     $field_list_array = array();
     $field_list_array['lastname']['name'] = get_lang('Lastname');
     $field_list_array['firstname']['name'] = get_lang('Firstname');
     if (api_get_setting('profile', 'name') != 'true') {
         $field_list_array['firstname']['visibility'] = 0;
         $field_list_array['lastname']['visibility'] = 0;
     } else {
         $field_list_array['firstname']['visibility'] = 1;
         $field_list_array['lastname']['visibility'] = 1;
     }
     $field_list_array['username']['name'] = get_lang('Username');
     $field_list_array['username']['visibility'] = 0;
     //	OFFICIAL CODE
     $field_list_array['official_code']['name'] = get_lang('OfficialCode');
     if (api_get_setting('profile', 'officialcode') != 'true') {
         $field_list_array['official_code']['visibility'] = 1;
     } else {
         $field_list_array['official_code']['visibility'] = 0;
     }
     // EMAIL
     $field_list_array['email']['name'] = get_lang('Email');
     if (api_get_setting('profile', 'email') != 'true') {
         $field_list_array['email']['visibility'] = 1;
     } else {
         $field_list_array['email']['visibility'] = 0;
     }
     // OPENID URL
     //$field_list_array[] = 'openid_authentication';
     /*
               if (is_profile_editable() && api_get_setting('openid_authentication') == 'true') {
               $form->addElement('text', 'openid', get_lang('OpenIDURL'), array('size' => 40));
               if (api_get_setting('profile', 'openid') != 'true') {
               $form->freeze('openid');
               }
               $form->applyFilter('openid', 'trim');
               //if (api_get_setting('registration', 'openid') == 'true')
               //	$form->addRule('openid', get_lang('ThisFieldIsRequired'), 'required');
               } */
     // PHONE
     $field_list_array['phone']['name'] = get_lang('Phone');
     if (api_get_setting('profile', 'phone') != 'true') {
         $field_list_array['phone']['visibility'] = 0;
     } else {
         $field_list_array['phone']['visibility'] = 1;
     }
     //	LANGUAGE
     $field_list_array['language']['name'] = get_lang('Language');
     if (api_get_setting('profile', 'language') != 'true') {
         $field_list_array['language']['visibility'] = 0;
     } else {
         $field_list_array['language']['visibility'] = 1;
     }
     // EXTRA FIELDS
     $extra = UserManager::get_extra_fields(0, 50, 5, 'ASC');
     $extra_data = UserManager::get_extra_user_data(api_get_user_id(), true);
     foreach ($extra as $id => $field_details) {
         if ($field_details[6] == 0) {
             continue;
         }
         switch ($field_details[2]) {
             case ExtraField::FIELD_TYPE_TEXT:
                 $field_list_array['extra_' . $field_details[1]]['name'] = $field_details[3];
                 if ($field_details[7] == 0) {
                     $field_list_array['extra_' . $field_details[1]]['visibility'] = 0;
                 } else {
                     $field_list_array['extra_' . $field_details[1]]['visibility'] = 1;
                 }
                 break;
             case ExtraField::FIELD_TYPE_TEXTAREA:
                 $field_list_array['extra_' . $field_details[1]]['name'] = $field_details[3];
                 if ($field_details[7] == 0) {
                     $field_list_array['extra_' . $field_details[1]]['visibility'] = 0;
                 } else {
                     $field_list_array['extra_' . $field_details[1]]['visibility'] = 1;
                 }
                 break;
             case ExtraField::FIELD_TYPE_RADIO:
                 $field_list_array['extra_' . $field_details[1]]['name'] = $field_details[3];
                 if ($field_details[7] == 0) {
                     $field_list_array['extra_' . $field_details[1]]['visibility'] = 0;
                 } else {
                     $field_list_array['extra_' . $field_details[1]]['visibility'] = 1;
                 }
                 break;
             case ExtraField::FIELD_TYPE_SELECT:
                 $field_list_array['extra_' . $field_details[1]]['name'] = $field_details[3];
                 if ($field_details[7] == 0) {
                     $field_list_array['extra_' . $field_details[1]]['visibility'] = 0;
                 } else {
                     $field_list_array['extra_' . $field_details[1]]['visibility'] = 1;
//.........这里部分代码省略.........
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:101,代码来源:survey.lib.php

示例3: export_complete_report_row_xls

 /**
  * Add a line to the csv file
  *
  * @param	array	Possible answers
  * @param	array	User's answers
  * @param 	mixed	User ID or user details as string - Used as a string in the result string
  * @param	boolean	Whether to display user fields or not
  * @return	string	One line of the csv file
  */
 public static function export_complete_report_row_xls($survey_data, $possible_options, $answers_of_user, $user, $display_extra_user_fields = false)
 {
     $return = array();
     if ($survey_data['anonymous'] == 0) {
         if (intval($user) !== 0) {
             $sql = 'SELECT firstname, lastname
                     FROM ' . Database::get_main_table(TABLE_MAIN_USER) . '
                     WHERE user_id=' . intval($user);
             $rs = Database::query($sql);
             if ($row = Database::fetch_array($rs)) {
                 $user_displayed = api_get_person_name($row['firstname'], $row['lastname']);
             } else {
                 $user_displayed = '-';
             }
             $return[] = $user_displayed;
         } else {
             $return[] = $user;
         }
     } else {
         $return[] = '-';
         // The user column
     }
     if ($display_extra_user_fields) {
         //show user fields data, if any, for this user
         $user_fields_values = UserManager::get_extra_user_data(intval($user), false, false, false, true);
         foreach ($user_fields_values as $value) {
             $return[] = api_html_entity_decode(strip_tags($value), ENT_QUOTES);
         }
     }
     if (is_array($possible_options)) {
         foreach ($possible_options as $question_id => &$possible_option) {
             if (is_array($possible_option) && count($possible_option) > 0) {
                 foreach ($possible_option as $option_id => &$value) {
                     $my_answers_of_user = $answers_of_user[$question_id] == null ? array() : $answers_of_user[$question_id];
                     $key = array_keys($my_answers_of_user);
                     if (substr($key[0], 0, 4) == 'open') {
                         $return[] = api_html_entity_decode(strip_tags($answers_of_user[$question_id][$key[0]]['option_id']), ENT_QUOTES);
                     } elseif (!empty($answers_of_user[$question_id][$option_id])) {
                         //$return .= 'v';
                         if ($answers_of_user[$question_id][$option_id]['value'] != 0) {
                             $return[] = $answers_of_user[$question_id][$option_id]['value'];
                         } else {
                             $return[] = 'v';
                         }
                     } else {
                         $return[] = '';
                     }
                 }
             }
         }
     }
     return $return;
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:62,代码来源:survey.lib.php

示例4: get_all_info_to_certificate

 /**
  * return all content to replace and all content to be replace
  */
 static function get_all_info_to_certificate($user_id, $course_id, $is_preview = false)
 {
     $info_list = array();
     $user_id = intval($user_id);
     $course_info = api_get_course_info($course_id);
     //info portal
     $organization_name = api_get_setting('platform.institution');
     $portal_name = api_get_setting('platform.site_name');
     //Extra user data information
     $extra_user_info_data = UserManager::get_extra_user_data($user_id, false, false, false, true);
     //Student information
     $user_info = api_get_user_info($user_id);
     $first_name = $user_info['firstname'];
     $last_name = $user_info['lastname'];
     $official_code = $user_info['official_code'];
     //Teacher information
     $info_teacher_id = UserManager::get_user_id_of_course_admin_or_session_admin($course_info);
     $teacher_info = api_get_user_info($info_teacher_id);
     $teacher_first_name = $teacher_info['firstname'];
     $teacher_last_name = $teacher_info['lastname'];
     // info gradebook certificate
     $info_grade_certificate = UserManager::get_info_gradebook_certificate($course_id, $user_id);
     $date_certificate = $info_grade_certificate['created_at'];
     $date_no_time = null;
     $date_long_certificate = '';
     if (!empty($date_certificate)) {
         $date_long_certificate = api_convert_and_format_date($date_certificate);
         $date_no_time = api_convert_and_format_date($date_certificate, DATE_FORMAT_LONG_NO_DAY);
     }
     if ($is_preview) {
         $date_long_certificate = api_convert_and_format_date(api_get_utc_datetime());
         $date_no_time = api_convert_and_format_date(api_get_utc_datetime(), DATE_FORMAT_LONG_NO_DAY);
     }
     $url = Certificate::getCertificatePublicURL($info_grade_certificate['id']);
     //replace content
     $info_to_replace_in_content_html = array($first_name, $last_name, $organization_name, $portal_name, $teacher_first_name, $teacher_last_name, $official_code, $date_long_certificate, $date_no_time, $course_id, $course_info['name'], $info_grade_certificate['grade'], $url, '<a href="' . $url . '" target="_blank">' . get_lang('CertificateOnlineLink') . '</a>', '((certificate_barcode))');
     $info_to_be_replaced_in_content_html = array('((user_firstname))', '((user_lastname))', '((gradebook_institution))', '((gradebook_sitename))', '((teacher_firstname))', '((teacher_lastname))', '((official_code))', '((date_certificate))', '((date_certificate_no_time))', '((course_code))', '((course_title))', '((gradebook_grade))', '((certificate_link))', '((certificate_link_html))', '((certificate_barcode))');
     if (!empty($extra_user_info_data)) {
         foreach ($extra_user_info_data as $key_extra => $value_extra) {
             $info_to_be_replaced_in_content_html[] = '((' . strtolower($key_extra) . '))';
             $info_to_replace_in_content_html[] = $value_extra;
         }
     }
     $info_list[] = $info_to_be_replaced_in_content_html;
     $info_list[] = $info_to_replace_in_content_html;
     return $info_list;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:50,代码来源:document.lib.php

示例5: exportCompleteReportXLS

 /**
  * Exports the complete report as an XLS file
  * @return	boolean		False on error
  */
 public function exportCompleteReportXLS($document_path = '', $user_id = null, $export_user_fields = false, $export_filter = 0, $exercise_id = 0, $hotpotato_name = null)
 {
     global $charset;
     $this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name);
     $filename = 'exercise_results_' . date('YmdGis') . '.xls';
     if (!empty($user_id)) {
         $filename = 'exercise_results_user_' . $user_id . '_' . date('YmdGis') . '.xls';
     }
     $workbook = new Spreadsheet_Excel_Writer();
     $workbook->setTempDir(api_get_path(SYS_ARCHIVE_PATH));
     $workbook->setVersion(8);
     // BIFF8
     $workbook->send($filename);
     $worksheet =& $workbook->addWorksheet('Report ' . date('YmdGis'));
     $worksheet->setInputEncoding(api_get_system_encoding());
     $line = 0;
     $column = 0;
     //skip the first column (row titles)
     // check if exists column 'user'
     $with_column_user = false;
     foreach ($this->results as $result) {
         if (!empty($result['last_name']) && !empty($result['first_name'])) {
             $with_column_user = true;
             break;
         }
     }
     if ($with_column_user) {
         $worksheet->write($line, $column, get_lang('Email'));
         $column++;
         if (api_is_western_name_order()) {
             $worksheet->write($line, $column, get_lang('FirstName'));
             $column++;
             $worksheet->write($line, $column, get_lang('LastName'));
             $column++;
         } else {
             $worksheet->write($line, $column, get_lang('LastName'));
             $column++;
             $worksheet->write($line, $column, get_lang('FirstName'));
             $column++;
         }
     }
     if ($export_user_fields) {
         //show user fields section with a big th colspan that spans over all fields
         $extra_user_fields = UserManager::get_extra_fields(0, 1000, 5, 'ASC', false, 1);
         //show the fields names for user fields
         foreach ($extra_user_fields as $field) {
             $worksheet->write($line, $column, api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset));
             $column++;
         }
     }
     $worksheet->write($line, $column, get_lang('Title'));
     $column++;
     $worksheet->write($line, $column, get_lang('StartDate'));
     $column++;
     $worksheet->write($line, $column, get_lang('EndDate'));
     $column++;
     $worksheet->write($line, $column, get_lang('Duration') . ' (' . get_lang('MinMinutes') . ')');
     $column++;
     $worksheet->write($line, $column, get_lang('Score'));
     $column++;
     $worksheet->write($line, $column, get_lang('Total'));
     $column++;
     $worksheet->write($line, $column, get_lang('Status'));
     $line++;
     foreach ($this->results as $row) {
         $column = 0;
         if ($with_column_user) {
             $worksheet->write($line, $column, api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset));
             $column++;
             if (api_is_western_name_order()) {
                 $worksheet->write($line, $column, api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
                 $column++;
                 $worksheet->write($line, $column, api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset));
                 $column++;
             } else {
                 $worksheet->write($line, $column, api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset));
                 $column++;
                 $worksheet->write($line, $column, api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
                 $column++;
             }
         }
         if ($export_user_fields) {
             //show user fields data, if any, for this user
             $user_fields_values = UserManager::get_extra_user_data($row['user_id'], false, false, false, true);
             foreach ($user_fields_values as $value) {
                 $worksheet->write($line, $column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset));
                 $column++;
             }
         }
         $worksheet->write($line, $column, api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset));
         $column++;
         $worksheet->write($line, $column, $row['start_date']);
         $column++;
         $worksheet->write($line, $column, $row['end_date']);
         $column++;
         $worksheet->write($line, $column, $row['duration']);
//.........这里部分代码省略.........
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:101,代码来源:hotpotatoes_exercise_result.class.php

示例6: get_user_overview_export_extra_fields

 /**
  * Get all information that the user with user_id = $user_data has
  * entered in the additionally defined profile fields
  * @param integer $user_id the id of the user
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
  * @version Dokeos 1.8.6
  * @since November 2008
  */
 function get_user_overview_export_extra_fields($user_id)
 {
     $extra_data = UserManager::get_extra_user_data($user_id, true);
     return $extra_data;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:13,代码来源:myspace.lib.php

示例7: array

 }
 $data = array();
 $extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', false);
 if ($export['addcsvheader'] == '1' and $export['file_type'] == 'csv') {
     if ($_configuration['password_encryption'] != 'none') {
         $data[] = array('UserId', 'LastName', 'FirstName', 'Email', 'UserName', 'AuthSource', 'Status', 'OfficialCode', 'PhoneNumber');
     } else {
         $data[] = array('UserId', 'LastName', 'FirstName', 'Email', 'UserName', 'Password', 'AuthSource', 'Status', 'OfficialCode', 'PhoneNumber');
     }
     foreach ($extra_fields as $extra) {
         $data[0][] = $extra[1];
     }
 }
 $res = Database::query($sql);
 while ($user = Database::fetch_array($res, 'ASSOC')) {
     $student_data = UserManager::get_extra_user_data($user['UserId'], true, false);
     foreach ($student_data as $key => $value) {
         $key = substr($key, 6);
         if (is_array($value)) {
             $user[$key] = $value[$key];
         } else {
             $user[$key] = $value;
         }
     }
     $data[] = $user;
 }
 switch ($file_type) {
     case 'xml':
         Export::arrayToXml($data, $filename, 'Contact', 'Contacts');
         exit;
         break;
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:user_export.php

示例8: get_lang

    if (api_get_setting('extended_profile') == 'true') {
        if (api_get_setting('extendedprofile_registration', 'mycomptetences') == 'true' && api_get_setting('extendedprofile_registrationrequired', 'mycomptetences') == 'true') {
            $form->addRule('competences', get_lang('ThisFieldIsRequired'), 'required');
        }
        if (api_get_setting('extendedprofile_registration', 'mydiplomas') == 'true' && api_get_setting('extendedprofile_registrationrequired', 'mydiplomas') == 'true') {
            $form->addRule('diplomas', get_lang('ThisFieldIsRequired'), 'required');
        }
        if (api_get_setting('extendedprofile_registration', 'myteach') == 'true' && api_get_setting('extendedprofile_registrationrequired', 'myteach') == 'true') {
            $form->addRule('teach', get_lang('ThisFieldIsRequired'), 'required');
        }
        if (api_get_setting('extendedprofile_registration', 'mypersonalopenarea') == 'true' && api_get_setting('extendedprofile_registrationrequired', 'mypersonalopenarea') == 'true') {
            $form->addRule('openarea', get_lang('ThisFieldIsRequired'), 'required');
        }
    }
    // EXTRA FIELDS
    $extra_data = UserManager::get_extra_user_data(api_get_user_id(), true);
    $extraField = new ExtraField('user');
    $extraField->set_extra_fields_in_form($form, $extra_data, 'registration', false, null);
}
if (isset($_SESSION['user_language_choice']) && $_SESSION['user_language_choice'] != '') {
    $defaults['language'] = $_SESSION['user_language_choice'];
} else {
    $defaults['language'] = api_get_setting('platformLanguage');
}
if (!empty($_GET['username'])) {
    $defaults['username'] = Security::remove_XSS($_GET['username']);
}
if (!empty($_GET['email'])) {
    $defaults['email'] = Security::remove_XSS($_GET['email']);
}
if (!empty($_GET['phone'])) {
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:inscription.php

示例9: get_lang

$form->addElement('select_language', 'language', get_lang('Language'), null);
// Send email
$group = array();
$group[] = $form->createElement('radio', 'send_mail', null, get_lang('Yes'), 1);
$group[] = $form->createElement('radio', 'send_mail', null, get_lang('No'), 0);
$form->addGroup($group, 'mail', get_lang('SendMailToNewUser'), '&nbsp;');
// Expiration Date
$form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0);
$group = array();
$group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('On'), 1);
$group[] = $form->createElement('datepicker', 'expiration_date', null, array('form_name' => $form->getAttribute('name'), 'onchange' => 'javascript: enable_expiration_date();'));
$form->addGroup($group, 'max_member_group', null, '', false);
// Active account or inactive account
$form->addElement('radio', 'active', get_lang('ActiveAccount'), get_lang('Active'), 1);
$form->addElement('radio', 'active', '', get_lang('Inactive'), 0);
$extra_data = UserManager::get_extra_user_data(0, true);
$return_params = UserManager::set_extra_fields_in_form($form, $extra_data, 'user_add');
$jquery_ready_content = $return_params['jquery_ready_content'];
// the $jquery_ready_content variable collects all functions that will be load in the $(document).ready javascript function
$htmlHeadXtra[] = '<script>
$(document).ready(function(){
	' . $jquery_ready_content . '
});
</script>';
// Set default values
$defaults['admin']['platform_admin'] = 0;
$defaults['mail']['send_mail'] = 1;
$defaults['password']['password_auto'] = 1;
$defaults['active'] = 1;
$defaults['expiration_date'] = array();
$days = api_get_setting('account_valid_duration');
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:user_add.php

示例10: save_notification

 /**
  * Save message notification
  * @param int	    $type message type
  * NOTIFICATION_TYPE_MESSAGE,
  * NOTIFICATION_TYPE_INVITATION,
  * NOTIFICATION_TYPE_GROUP
  * @param array	    $user_list recipients: user list of ids
  * @param string	$title
  * @param string	$content
  * @param array	    $sender_info
  * result of api_get_user_info() or GroupPortalManager:get_group_data()
  */
 public function save_notification($type, $user_list, $title, $content, $senderInfo = array())
 {
     $this->type = intval($type);
     $content = $this->formatContent($content, $senderInfo);
     $titleToNotification = $this->formatTitle($title, $senderInfo);
     $settingToCheck = '';
     $avoid_my_self = false;
     switch ($this->type) {
         case self::NOTIFICATION_TYPE_DIRECT_MESSAGE:
         case self::NOTIFICATION_TYPE_MESSAGE:
             $settingToCheck = 'mail_notify_message';
             $defaultStatus = self::NOTIFY_MESSAGE_AT_ONCE;
             break;
         case self::NOTIFICATION_TYPE_INVITATION:
             $settingToCheck = 'mail_notify_invitation';
             $defaultStatus = self::NOTIFY_INVITATION_AT_ONCE;
             break;
         case self::NOTIFICATION_TYPE_GROUP:
             $settingToCheck = 'mail_notify_group_message';
             $defaultStatus = self::NOTIFY_GROUP_AT_ONCE;
             $avoid_my_self = true;
             break;
         default:
             $defaultStatus = self::NOTIFY_MESSAGE_AT_ONCE;
             break;
     }
     $settingInfo = UserManager::get_extra_field_information_by_name($settingToCheck);
     if (!empty($user_list)) {
         foreach ($user_list as $user_id) {
             if ($avoid_my_self) {
                 if ($user_id == api_get_user_id()) {
                     continue;
                 }
             }
             $userInfo = api_get_user_info($user_id);
             // Extra field was deleted or removed? Use the default status.
             $userSetting = $defaultStatus;
             if (!empty($settingInfo)) {
                 $extra_data = UserManager::get_extra_user_data($user_id);
                 if (isset($extra_data[$settingToCheck]) && !empty($extra_data[$settingToCheck])) {
                     $userSetting = $extra_data[$settingToCheck];
                 }
             }
             $sendDate = null;
             switch ($userSetting) {
                 // No notifications
                 case self::NOTIFY_MESSAGE_NO:
                 case self::NOTIFY_INVITATION_NO:
                 case self::NOTIFY_GROUP_NO:
                     break;
                     // Send notification right now!
                 // Send notification right now!
                 case self::NOTIFY_MESSAGE_AT_ONCE:
                 case self::NOTIFY_INVITATION_AT_ONCE:
                 case self::NOTIFY_GROUP_AT_ONCE:
                     $extraHeaders = [];
                     if (isset($senderInfo['email'])) {
                         $extraHeaders = array('reply_to' => array('name' => $senderInfo['complete_name'], 'mail' => $senderInfo['email']));
                     }
                     if (!empty($userInfo['email'])) {
                         api_mail_html($userInfo['complete_name'], $userInfo['mail'], Security::filter_terms($titleToNotification), Security::filter_terms($content), $this->adminName, $this->adminEmail, $extraHeaders);
                     }
                     $sendDate = api_get_utc_datetime();
             }
             // Saving the notification to be sent some day.
             $params = array('sent_at' => $sendDate, 'dest_user_id' => $user_id, 'dest_mail' => $userInfo['email'], 'title' => $title, 'content' => cut($content, $this->max_content_length), 'send_freq' => $userSetting);
             $this->save($params);
         }
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:82,代码来源:notification.lib.php

示例11: save_notification

 /**
  * Save message notification
  * @param    array    message type NOTIFICATION_TYPE_MESSAGE, NOTIFICATION_TYPE_INVITATION, NOTIFICATION_TYPE_GROUP
  * @param    array    recipients: user list of ids
  * @param    string    title
  * @param    string    content of the message
  * @param    array    result of api_get_user_info() or UserGroup->get()
  */
 public function save_notification($type, $user_list, $title, $content, $sender_info = array(), $text_content = null)
 {
     $this->type = intval($type);
     $content = $this->format_content($content, $sender_info);
     $sender_id = 0;
     if (!empty($sender_info) && isset($sender_info['user_id'])) {
         $sender_id = $sender_info['user_id'];
         $this->set_sender_info($sender_id);
     }
     $setting_to_check = '';
     $avoid_my_self = false;
     $default_status = self::NOTIFY_MESSAGE_AT_ONCE;
     switch ($this->type) {
         case self::NOTIFICATION_TYPE_MESSAGE:
             $setting_to_check = 'mail_notify_message';
             $default_status = self::NOTIFY_MESSAGE_AT_ONCE;
             break;
         case self::NOTIFICATION_TYPE_INVITATION:
             $setting_to_check = 'mail_notify_invitation';
             $default_status = self::NOTIFY_INVITATION_AT_ONCE;
             break;
         case self::NOTIFICATION_TYPE_GROUP:
             $setting_to_check = 'mail_notify_group_message';
             $default_status = self::NOTIFY_GROUP_AT_ONCE;
             $avoid_my_self = true;
             break;
     }
     $setting_info = UserManager::get_extra_field_information_by_name($setting_to_check);
     if (!empty($user_list)) {
         foreach ($user_list as $user_id) {
             if ($avoid_my_self) {
                 if ($user_id == api_get_user_id()) {
                     continue;
                 }
             }
             $user_info = api_get_user_info($user_id);
             //Extra field was deleted or removed? Use the default status
             if (empty($setting_info)) {
                 $user_setting = $default_status;
             } else {
                 $extra_data = UserManager::get_extra_user_data($user_id);
                 $user_setting = $extra_data[$setting_to_check];
             }
             $params = array();
             switch ($user_setting) {
                 //No notifications
                 case self::NOTIFY_MESSAGE_NO:
                 case self::NOTIFY_INVITATION_NO:
                 case self::NOTIFY_GROUP_NO:
                     break;
                     //Send notification right now!
                 //Send notification right now!
                 case self::NOTIFY_MESSAGE_AT_ONCE:
                 case self::NOTIFY_INVITATION_AT_ONCE:
                 case self::NOTIFY_GROUP_AT_ONCE:
                     if (!empty($user_info['mail'])) {
                         $name = api_get_person_name($user_info['firstname'], $user_info['lastname']);
                         if (!empty($sender_info['complete_name']) && !empty($sender_info['email'])) {
                             $extra_headers = array();
                             $extra_headers['reply_to']['mail'] = $sender_info['email'];
                             $extra_headers['reply_to']['name'] = $sender_info['complete_name'];
                             api_mail_html($name, $user_info['mail'], Security::filter_terms($title), Security::filter_terms($content), $sender_info['complete_name'], $sender_info['email'], $extra_headers, array(), null, $text_content);
                         } else {
                             api_mail_html($name, $user_info['mail'], Security::filter_terms($title), Security::filter_terms($content), $sender_info['complete_name'], $sender_info['email'], array(), null, $text_content);
                         }
                     }
                     $params['sent_at'] = api_get_utc_datetime();
                     // Saving the notification to be sent some day.
                 // Saving the notification to be sent some day.
                 default:
                     $params['dest_user_id'] = $user_id;
                     $params['dest_mail'] = $user_info['mail'];
                     $params['title'] = $title;
                     $params['content'] = Text::cut($content, $this->max_content_length);
                     $params['send_freq'] = $user_setting;
                     $params['sender_id'] = $sender_id;
                     $this->save($params);
                     break;
             }
         }
     }
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:90,代码来源:notification.lib.php

示例12: array

    array(
        'class' => 'nextPage next',
    )
);

$socialRightInformation =  SocialManager::social_wrapper_div($personal_info, 4);

//$social_right_content .= SocialManager::social_wrapper_div($wallSocial, 5);


if ($show_full_profile) {

    // Extra information
    $t_uf    = Database :: get_main_table(TABLE_MAIN_USER_FIELD);
    $t_ufo    = Database :: get_main_table(TABLE_MAIN_USER_FIELD_OPTIONS);
    $extra_user_data = UserManager::get_extra_user_data($user_id);
    $extra_information = '';
    if (is_array($extra_user_data) && count($extra_user_data)>0 ) {

        $extra_information .= '<div><h3>'.get_lang('ExtraInformation').'</h3></div>';
        $extra_information .='<div class="social-profile-info">';
        $extra_information_value = '';
        foreach($extra_user_data as $key=>$data) {
            //Avoding parameters
            if (in_array($key, array('mail_notify_invitation','mail_notify_message', 'mail_notify_group_message' ))) {
                continue;
            }
            // get display text, visibility and type from user_field table
            $field_variable = str_replace('extra_','',$key);
            $sql = "SELECT field_display_text,field_visible,field_type,id "
                ." FROM $t_uf WHERE field_variable ='$field_variable'";
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:profile.php

示例13: exportCompleteReportXLS


//.........这里部分代码省略.........
             $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('LastName'));
             $column++;
         } else {
             $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('LastName'));
             $column++;
             $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('FirstName'));
             $column++;
         }
         if ($officialCodeInList === 'true') {
             $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('OfficialCode'));
             $column++;
         }
         $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Email'));
         $column++;
     }
     $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Groups'));
     $column++;
     if ($export_user_fields) {
         //show user fields section with a big th colspan that spans over all fields
         $extra_user_fields = UserManager::get_extra_fields(0, 1000, 5, 'ASC', false, 1);
         //show the fields names for user fields
         foreach ($extra_user_fields as $field) {
             $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset));
             $column++;
         }
     }
     $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Title'));
     $column++;
     $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('StartDate'));
     $column++;
     $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('EndDate'));
     $column++;
     $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Duration') . ' (' . get_lang('MinMinutes') . ')');
     $column++;
     $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Score'));
     $column++;
     $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Total'));
     $column++;
     $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Status'));
     $column++;
     $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('ToolLearnpath'));
     $column++;
     $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('UserIsCurrentlySubscribed'));
     $line++;
     foreach ($this->results as $row) {
         $column = 0;
         if ($with_column_user) {
             if (api_is_western_name_order()) {
                 $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
                 $column++;
                 $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset));
                 $column++;
             } else {
                 $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset));
                 $column++;
                 $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
                 $column++;
             }
             if ($officialCodeInList === 'true') {
                 $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['official_code']), ENT_QUOTES, $charset));
                 $column++;
             }
             $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset));
             $column++;
         }
         $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags(implode(", ", GroupManager::get_user_group_name($row['user_id']))), ENT_QUOTES, $charset));
         $column++;
         if ($export_user_fields) {
             //show user fields data, if any, for this user
             $user_fields_values = UserManager::get_extra_user_data($row['user_id'], false, false, false, true);
             foreach ($user_fields_values as $value) {
                 $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset));
                 $column++;
             }
         }
         $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset));
         $column++;
         $worksheet->SetCellValueByColumnAndRow($line, $column, $row['start_date']);
         $column++;
         $worksheet->SetCellValueByColumnAndRow($line, $column, $row['end_date']);
         $column++;
         $worksheet->SetCellValueByColumnAndRow($line, $column, $row['duration']);
         $column++;
         $worksheet->SetCellValueByColumnAndRow($line, $column, $row['result']);
         $column++;
         $worksheet->SetCellValueByColumnAndRow($line, $column, $row['max']);
         $column++;
         $worksheet->SetCellValueByColumnAndRow($line, $column, $row['status']);
         $column++;
         $worksheet->SetCellValueByColumnAndRow($line, $column, $row['lp_name']);
         $column++;
         $worksheet->SetCellValueByColumnAndRow($line, $column, $row['is_user_subscribed']);
         $line++;
     }
     $file = api_get_path(SYS_ARCHIVE_PATH) . api_replace_dangerous_char($filename);
     $writer = new PHPExcel_Writer_Excel2007($spreadsheet);
     $writer->save($file);
     DocumentManager::file_send_for_download($file, true, $filename);
     return true;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:101,代码来源:exercise_result.class.php

示例14: make_field_list

 /**
  * Creates a multi array with the user fields that we can show. We look the visibility with the api_get_setting function
  * The username is always NOT able to change it.
  * @author Julio Montoya Armas <gugli100@gmail.com>, Chamilo: Personality Test modification
  * @return array[value_name][name]
  * 		   array[value_name][visibilty]
  */
 static function make_field_list()
 {
     //	LAST NAME and FIRST NAME
     $field_list_array = array();
     $field_list_array['lastname']['name'] = get_lang('Lastname');
     $field_list_array['firstname']['name'] = get_lang('Firstname');
     if (api_get_setting('profile', 'name') != 'true') {
         $field_list_array['firstname']['visibility'] = 0;
         $field_list_array['lastname']['visibility'] = 0;
     } else {
         $field_list_array['firstname']['visibility'] = 1;
         $field_list_array['lastname']['visibility'] = 1;
     }
     $field_list_array['username']['name'] = get_lang('Username');
     $field_list_array['username']['visibility'] = 0;
     //	OFFICIAL CODE
     $field_list_array['official_code']['name'] = get_lang('OfficialCode');
     if (api_get_setting('profile', 'officialcode') != 'true') {
         $field_list_array['official_code']['visibility'] = 1;
     } else {
         $field_list_array['official_code']['visibility'] = 0;
     }
     // EMAIL
     $field_list_array['email']['name'] = get_lang('Email');
     if (api_get_setting('profile', 'email') != 'true') {
         $field_list_array['email']['visibility'] = 1;
     } else {
         $field_list_array['email']['visibility'] = 0;
     }
     // OPENID URL
     //$field_list_array[] = 'openid_authentication';
     /*
     		if (is_profile_editable() && api_get_setting('openid_authentication') == 'true') {
     			$form->addElement('text', 'openid', get_lang('OpenIDURL'), array('size' => 40));
     			if (api_get_setting('profile', 'openid') != 'true') {
     				$form->freeze('openid');
     			}
     			$form->applyFilter('openid', 'trim');
     			//if (api_get_setting('registration', 'openid') == 'true')
     			//	$form->addRule('openid', get_lang('ThisFieldIsRequired'), 'required');
     		}*/
     // PHONE
     $field_list_array['phone']['name'] = get_lang('Phone');
     if (api_get_setting('profile', 'phone') != 'true') {
         $field_list_array['phone']['visibility'] = 0;
     } else {
         $field_list_array['phone']['visibility'] = 1;
     }
     //	LANGUAGE
     $field_list_array['language']['name'] = get_lang('Language');
     if (api_get_setting('profile', 'language') != 'true') {
         $field_list_array['language']['visibility'] = 0;
     } else {
         $field_list_array['language']['visibility'] = 1;
     }
     // EXTRA FIELDS
     $extra = UserManager::get_extra_fields(0, 50, 5, 'ASC');
     $extra_data = UserManager::get_extra_user_data(api_get_user_id(), true);
     foreach ($extra as $id => $field_details) {
         if ($field_details[6] == 0) {
             continue;
         }
         switch ($field_details[2]) {
             case UserManager::USER_FIELD_TYPE_TEXT:
                 $field_list_array['extra_' . $field_details[1]]['name'] = $field_details[3];
                 if ($field_details[7] == 0) {
                     $field_list_array['extra_' . $field_details[1]]['visibility'] = 0;
                 } else {
                     $field_list_array['extra_' . $field_details[1]]['visibility'] = 1;
                 }
                 break;
             case UserManager::USER_FIELD_TYPE_TEXTAREA:
                 $field_list_array['extra_' . $field_details[1]]['name'] = $field_details[3];
                 if ($field_details[7] == 0) {
                     $field_list_array['extra_' . $field_details[1]]['visibility'] = 0;
                 } else {
                     $field_list_array['extra_' . $field_details[1]]['visibility'] = 1;
                 }
                 break;
             case UserManager::USER_FIELD_TYPE_RADIO:
                 $field_list_array['extra_' . $field_details[1]]['name'] = $field_details[3];
                 if ($field_details[7] == 0) {
                     $field_list_array['extra_' . $field_details[1]]['visibility'] = 0;
                 } else {
                     $field_list_array['extra_' . $field_details[1]]['visibility'] = 1;
                 }
                 break;
             case UserManager::USER_FIELD_TYPE_SELECT:
                 $field_list_array['extra_' . $field_details[1]]['name'] = $field_details[3];
                 if ($field_details[7] == 0) {
                     $field_list_array['extra_' . $field_details[1]]['visibility'] = 0;
                 } else {
                     $field_list_array['extra_' . $field_details[1]]['visibility'] = 1;
//.........这里部分代码省略.........
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:101,代码来源:survey.lib.php

示例15: while

     $sql .= " AND user.user_id = au.user_id  AND access_url_id =  {$current_access_url_id}  ";
 }
 //only users no teachers/coaches
 $sql .= " AND course_user.status = 5 ";
 $sql .= $sort_by_first_name ? " ORDER BY user.firstname, user.lastname" : " ORDER BY user.lastname, user.firstname";
 $rs = Database::query($sql);
 $counter = 1;
 while ($user = Database::fetch_array($rs, 'ASSOC')) {
     if (isset($user['legal_agreement'])) {
         if ($user['legal_agreement'] == 1) {
             $user['legal_agreement'] = get_lang('Yes');
         } else {
             $user['legal_agreement'] = get_lang('No');
         }
     }
     $extra_fields = UserManager::get_extra_user_data($user['user_id'], false, false, false, true);
     if (!empty($extra_fields)) {
         foreach ($extra_fields as $key => $extra_value) {
             $user[$key] = $extra_value;
         }
     }
     if ($_GET['type'] == 'pdf') {
         $user_info = api_get_user_info($user['user_id']);
         $user_image = Display::img($user_info['avatar'], null, array('width' => $user_image_pdf_size . 'px'));
         if ($is_western_name_order) {
             $user_pdf = array($counter, $user_image, $user['official_code'], $user['firstname'] . ', ' . $user['lastname'], $user['email'], $user['phone']);
         } else {
             $user_pdf = array($counter, $user_image, $user['official_code'], $user['lastname'] . ', ' . $user['firstname'], $user['email'], $user['phone']);
         }
         $a_users[] = $user_pdf;
     } else {
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:user.php


注:本文中的UserManager::get_extra_user_data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。