function getpar($name, $description, $default = '') { $value = isset($_GET[$value = api_strtolower($name)]) ? $_GET[$value] : ''; $value = get_magic_quotes_gpc() ? stripslashes($value) : $value; if (!$value) $value = $default; if ($value == '') give_up('URL parameter ' . api_strtoupper($name) . ' - ' . $description . ' - is required'); define(api_strtoupper($name), $value); }
/** * Get array containing column header names (incl user columns) * @param int $items_start Start item offset * @param int $items_count Number of items to get * @param bool $show_detail whether to show the details or not * @return array List of headers */ public function get_header_names($items_start = 0, $items_count = null, $show_detail = false) { $headers = array(); if (isset($this->params['show_official_code']) && $this->params['show_official_code']) { $headers[] = get_lang('OfficialCode'); } if (isset($this->params['join_firstname_lastname']) && $this->params['join_firstname_lastname']) { if (api_is_western_name_order()) { $headers[] = get_lang('FirstnameAndLastname'); } else { $headers[] = get_lang('LastnameAndFirstname'); } } else { if (api_is_western_name_order()) { $headers[] = get_lang('FirstName'); $headers[] = get_lang('LastName'); } else { $headers[] = get_lang('LastName'); $headers[] = get_lang('FirstName'); } } if (!isset($items_count)) { $items_count = count($this->evals_links) - $items_start; } $parent_id = $this->category->get_parent_id(); if ($parent_id == 0 or $this->params['only_subcat'] == $this->category->get_id()) { $main_weight = $this->category->get_weight(); $grade_model_id = $this->category->get_grade_model_id(); } else { $main_cat = Category::load($parent_id, null, null); $main_weight = $main_cat[0]->get_weight(); $grade_model_id = $main_cat[0]->get_grade_model_id(); } $use_grade_model = true; if (empty($grade_model_id) || $grade_model_id == -1) { $use_grade_model = false; } //@todo move these in a function $sum_categories_weight_array = array(); $mainCategoryId = null; $mainCourseCategory = $this->getMainCourseCategory(); if (!empty($mainCourseCategory)) { $mainCategoryId = $mainCourseCategory->get_id(); } if (isset($this->category) && !empty($this->category)) { $categories = Category::load(null, null, null, $this->category->get_id()); if (!empty($categories)) { foreach ($categories as $category) { $sum_categories_weight_array[$category->get_id()] = $category->get_weight(); } } else { $sum_categories_weight_array[$this->category->get_id()] = $this->category->get_weight(); } } //No category was added $course_code = api_get_course_id(); $session_id = api_get_session_id(); $allcat = $this->category->get_subcategories(null, $course_code, $session_id, 'ORDER BY id'); $evaluationsAdded = array(); if ($parent_id == 0 && !empty($allcat)) { //Means there are any subcategory foreach ($allcat as $sub_cat) { $sub_cat_weight = round(100 * $sub_cat->get_weight() / $main_weight, 1); $add_weight = " {$sub_cat_weight} %"; /*if (isset($this->params['export_pdf']) && $this->params['export_pdf']) { $add_weight = null; }*/ $headers[] = Display::url($sub_cat->get_name(), api_get_self() . '?selectcat=' . $sub_cat->get_id()) . $add_weight; } } else { if (!isset($this->params['only_total_category']) || isset($this->params['only_total_category']) && $this->params['only_total_category'] == false) { for ($count = 0; $count < $items_count && $items_start + $count < count($this->evals_links); $count++) { $item = $this->evals_links[$count + $items_start]; $weight = round(100 * $item->get_weight() / $main_weight, 1); $headers[] = $item->get_name() . ' ' . $weight . ' % '; $evaluationsAdded[] = $item->get_id(); } } } if (!empty($mainCategoryId)) { for ($count = 0; $count < $items_count && $items_start + $count < count($this->evals_links); $count++) { /** @var AbstractLink $item */ $item = $this->evals_links[$count + $items_start]; if ($mainCategoryId == $item->get_category_id() && !in_array($item->get_id(), $evaluationsAdded)) { $weight = round(100 * $item->get_weight() / $main_weight, 1); $headers[] = $item->get_name() . ' ' . $weight . ' % '; } } } $headers[] = api_strtoupper(get_lang('GradebookQualificationTotal')); return $headers; }
/** * Build the prefilter form. * * This type allow filter all other multiple select terms by one term in a dinamic way */ function search_widget_prefilter_form($action, $show_thesaurus, $sf_terms, $op, $prefilter_prefix = NULL) { $thesaurus_icon = Display::return_icon('thesaurus.gif', get_lang('SearchAdvancedOptions'), array('id' => 'thesaurus-icon')); $advanced_options = '<a id="tags-toggle" href="#">' . get_lang('SearchAdvancedOptions') . '</a>'; $display_thesaurus = $show_thesaurus == true ? 'block' : 'none'; $help = '<h3>' . get_lang('SearchKeywordsHelpTitle') . '</h3>' . get_lang('SearchKeywordsHelpComment'); $mode = !empty($_REQUEST['mode']) ? htmlentities($_REQUEST['mode']) : 'gallery'; $type = !empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal'; /** * POST avoid long urls, but we are using GET because * SortableTableFromArray pagination is done with simple links, so now we * could not send a form in pagination */ if (isset($_GET['action']) && strcmp(trim($_GET['action']), 'search') === 0) { $action = 'index.php'; } $form = ' <form id="chamilo_search" action="' . $action . '" method="GET"> <input type="text" id="query" name="query" size="40" /> <input type="hidden" name="mode" value="' . $mode . '"/> <input type="hidden" name="type" value="' . $type . '"/> <input type="hidden" name="tablename_page_nr" value="1" /> <input type="submit" id="submit" value="' . get_lang("Search") . '" /> <br /><br />'; $list = get_specific_field_list(); if (!empty($list)) { $form .= ' <span class="search-links-box">' . $thesaurus_icon . $advanced_options . ' </span> <div id="tags" class="tags" style="display:' . $display_thesaurus . ';"> <div class="search-help-box">' . $help . '</div> <table> <tr>'; if (!is_null($prefilter_prefix)) { //sorting the array of terms $temp = array(); foreach ($sf_terms[$prefilter_prefix] as $key => $value) { $temp[trim(stripslashes($value['name']))] = $key; } $temp = array_flip($temp); unset($sf_term_array); natcasesort($temp); $sf_term_array = $temp; // get specific field name $sf_value = get_specific_field_list(array('code' => "'{$prefilter_prefix}'")); $sf_value = array_shift($sf_value); $form .= '<label class="sf-select-multiple-title" for="sf_' . $prefix . '[]">' . $icons_for_search_terms[$prefix] . ' ' . $sf_value['name'] . '</label><br />'; $form .= format_one_specific_field_select($prefilter_prefix, $sf_term_array, $op, 'id="prefilter"'); $form .= format_specific_fields_selects($sf_terms, $op, $prefilter_prefix); } else { $form .= format_specific_fields_selects($sf_terms, $op); } $or_checked = ''; $and_checked = ''; if ($op == 'or') { $or_checked = 'checked="checked"'; } else { if ($op == 'and') { $and_checked = 'checked="checked"'; } } $form .= ' </tr> <tr> <td id="operator-select"> ' . get_lang('SearchCombineSearchWith') . ':<br /> <input type="radio" class="search-operator" name="operator" value="or" ' . $or_checked . '>' . api_strtoupper(get_lang('Or')) . '</input> <input type="radio" class="search-operator" name="operator" value="and" ' . $and_checked . '>' . api_strtoupper(get_lang('And')) . '</input> </td> <td></td> <td> <br /> <input class="lower-submit" type="submit" value="' . get_lang('Search') . '" /> <input type="submit" id="tags-clean" value="' . get_lang('SearchResetKeywords') . '" /> </td> </tr> </table> </div>'; } $form .= ' </form> <br style="clear: both;"/>'; return $form; }
/** * @param string $file * @param bool $updatesession options: * true: if the session exists it will be updated * false: if session exists a new session will be created adding a counter session1, session2, etc * @param int $user_id * @param $logger * @param array convert a file row to an extra field. Example in CSV file there's a SessionID then it will * converted to extra_external_session_id if you set this: array('SessionId' => 'extra_external_session_id') * @param array extra fields * @param string extra field id * @param int $daysCoachAccessBeforeBeginning * @param int $daysCoachAccessAfterBeginning * @param int $sessionVisibility * @return array */ static function importCSV($file, $updatesession, $defaultUserId = null, $logger = null, $extraFields = array(), $extraFieldId = null, $daysCoachAccessBeforeBeginning = null, $daysCoachAccessAfterBeginning = null, $sessionVisibility = 1, $fieldsToAvoidUpdate = array()) { $content = file($file); $error_message = null; $session_counter = 0; if (empty($defaultUserId)) { $defaultUserId = api_get_user_id(); } $eol = PHP_EOL; if (PHP_SAPI != 'cli') { $eol = '<br />'; } $debug = false; if (isset($logger)) { $debug = true; } $extraParameters = null; if (!empty($daysCoachAccessBeforeBeginning) && !empty($daysCoachAccessAfterBeginning)) { $extraParameters .= ' , nb_days_access_before_beginning = ' . intval($daysCoachAccessBeforeBeginning); $extraParameters .= ' , nb_days_access_after_end = ' . intval($daysCoachAccessAfterBeginning); } $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $sessions = array(); if (!api_strstr($content[0], ';')) { $error_message = get_lang('NotCSV'); } else { $tag_names = array(); foreach ($content as $key => $enreg) { $enreg = explode(';', trim($enreg)); if ($key) { foreach ($tag_names as $tag_key => $tag_name) { $sessions[$key - 1][$tag_name] = $enreg[$tag_key]; } } else { foreach ($enreg as $tag_name) { $tag_names[] = api_preg_replace('/[^a-zA-Z0-9_\\-]/', '', $tag_name); } if (!in_array('SessionName', $tag_names) || !in_array('DateStart', $tag_names) || !in_array('DateEnd', $tag_names)) { $error_message = get_lang('NoNeededData'); break; } } } // Looping the sessions. foreach ($sessions as $enreg) { $user_counter = 0; $course_counter = 0; if (isset($extraFields) && !empty($extraFields)) { foreach ($extraFields as $original => $to) { $enreg[$to] = $enreg[$original]; } } $session_name = Database::escape_string($enreg['SessionName']); $date_start = $enreg['DateStart']; $date_end = $enreg['DateEnd']; $visibility = isset($enreg['Visibility']) ? $enreg['Visibility'] : $sessionVisibility; $session_category_id = isset($enreg['SessionCategory']) ? $enreg['SessionCategory'] : null; // Searching a general coach. if (!empty($enreg['Coach'])) { $coach_id = UserManager::get_user_id_from_username($enreg['Coach']); if ($coach_id === false) { // If the coach-user does not exist - I'm the coach. $coach_id = $defaultUserId; } } else { $coach_id = $defaultUserId; } if (!$updatesession) { // Always create a session. $unique_name = false; // This MUST be initializead. $i = 0; // Change session name, verify that session doesn't exist. $suffix = null; while (!$unique_name) { if ($i > 1) { $suffix = ' - ' . $i; } $sql = 'SELECT 1 FROM ' . $tbl_session . ' WHERE name="' . $session_name . $suffix . '"'; $rs = Database::query($sql); if (Database::result($rs, 0, 0)) { $i++; } else { $unique_name = true; $session_name .= $suffix; } } // Creating the session. /*$sql_session = "INSERT IGNORE INTO $tbl_session SET name = '".$session_name."', id_coach = '$coach_id', date_start = '$date_start', date_end = '$date_end', visibility = '$visibility', session_category_id = '$session_category_id', session_admin_id=".intval($defaultUserId).$extraParameters; Database::query($sql_session);*/ $params = array('id_coach' => $coach_id, 'visibility' => $visibility, 'name' => $session_name, 'access_start_date' => $date_start, 'access_end_date' => $date_end, 'session_category_id' => $session_category_id, 'session_admin_id' => $defaultUserId); $session_id = SessionManager::add($params); if ($debug) { if ($session_id) { foreach ($enreg as $key => $value) { if (substr($key, 0, 6) == 'extra_') { //an extra field self::update_session_extra_field_value($session_id, substr($key, 6), $value); } } $logger->addInfo("Sessions - Session created: #{$session_id} - {$session_name}"); } else { $logger->addError("Sessions - Session NOT created: {$session_name}"); } } $session_counter++; } else { $sessionId = null; if (isset($extraFields) && !empty($extraFields)) { $sessionId = self::get_session_id_from_original_id($enreg['extra_' . $extraFieldId], $extraFieldId); if (empty($sessionId)) { $my_session_result = false; } else { $my_session_result = true; } } else { $my_session_result = self::get_session_by_name($enreg['SessionName']); } if ($my_session_result === false) { // Creating a session. /*$sql_session = "INSERT IGNORE INTO $tbl_session SET name = '$session_name', id_coach = '$coach_id', date_start = '$date_start', date_end = '$date_end', visibility = '$visibility', session_category_id = '$session_category_id' ".$extraParameters;*/ $params = array('id_coach' => $coach_id, 'visibility' => $visibility, 'name' => $session_name, 'access_start_date' => $date_start, 'access_end_date' => $date_end, 'session_category_id' => $session_category_id, 'session_admin_id' => $defaultUserId); $session_id = SessionManager::add($params); // We get the last insert id. /*$my_session_result = SessionManager::get_session_by_name($enreg['SessionName']); $session_id = $my_session_result['id'];*/ if ($debug) { if ($session_id) { foreach ($enreg as $key => $value) { if (substr($key, 0, 6) == 'extra_') { //an extra field self::update_session_extra_field_value($session_id, substr($key, 6), $value); } } $logger->addInfo("Sessions - #{$session_id} created: {$session_name}"); } else { $logger->addError("Sessions - Session NOT created: {$session_name}"); } } } else { $params = array('id_coach' => $coach_id, 'date_start' => $date_start, 'date_end' => $date_end, 'visibility' => $visibility, 'session_category_id' => $session_category_id); if (!empty($fieldsToAvoidUpdate)) { foreach ($fieldsToAvoidUpdate as $field) { unset($params[$field]); } } if (isset($sessionId) && !empty($sessionId)) { // The session already exists, update it then. Database::update($tbl_session, $params, array('id = ?' => $sessionId)); $session_id = $sessionId; } else { Database::update($tbl_session, $params, array("name = '?' " => $enreg['SessionName'])); $row = Database::query("SELECT id FROM {$tbl_session} WHERE name = '{$session_name}'"); list($session_id) = Database::fetch_array($row); } foreach ($enreg as $key => $value) { if (substr($key, 0, 6) == 'extra_') { //an extra field self::update_session_extra_field_value($session_id, substr($key, 6), $value); } } Database::query("DELETE FROM {$tbl_session_user} WHERE id_session='{$session_id}'"); Database::query("DELETE FROM {$tbl_session_course} WHERE id_session='{$session_id}'"); Database::query("DELETE FROM {$tbl_session_course_user} WHERE id_session='{$session_id}'"); } $session_counter++; } $users = explode('|', $enreg['Users']); // Adding the relationship "Session - User". if (is_array($users)) { foreach ($users as $user) { $user_id = UserManager::get_user_id_from_username($user); if ($user_id !== false) { // Insert new users. $sql = "INSERT IGNORE INTO {$tbl_session_user} SET\n id_user = '******',\n id_session = '{$session_id}'"; Database::query($sql); if ($debug) { $logger->addInfo("Sessions - Adding User #{$user_id} ({$user}) to session #{$session_id}"); } $user_counter++; } } } $courses = explode('|', $enreg['Courses']); foreach ($courses as $course) { $course_code = api_strtoupper(api_substr($course, 0, api_strpos($course, '['))); if (CourseManager::course_exists($course_code)) { $courseInfo = api_get_course_info($course_code); $courseId = $courseInfo['real_id']; // Adding the course to a session. $sql_course = "INSERT IGNORE INTO {$tbl_session_course}\n SET c_id = '" . $courseId . "', id_session = '{$session_id}'"; Database::query($sql_course); if ($debug) { $logger->addInfo("Sessions - Adding course '{$course_code}' to session #{$session_id}"); } $course_counter++; $pattern = "/\\[(.*?)\\]/"; preg_match_all($pattern, $course, $matches); if (isset($matches[1])) { $course_coaches = $matches[1][0]; $course_users = $matches[1][1]; } $course_users = explode(',', $course_users); $course_coaches = explode(',', $course_coaches); // Adding coaches to session course user if (!empty($course_coaches)) { foreach ($course_coaches as $course_coach) { $coach_id = UserManager::get_user_id_from_username($course_coach); if ($coach_id !== false) { $sql = "INSERT IGNORE INTO {$tbl_session_course_user} SET\n id_user='******',\n c_id ='{$courseId}',\n id_session = '{$session_id}',\n status = 2 "; Database::query($sql); if ($debug) { $logger->addInfo("Sessions - Adding course coach: user #{$coach_id} ({$course_coach}) to course: '{$course_code}' and session #{$session_id}"); } } else { $error_message .= get_lang('UserDoesNotExist') . ' : ' . $course_coach . $eol; } } } $users_in_course_counter = 0; // Adding the relationship "Session - Course - User". foreach ($course_users as $user) { $user_id = UserManager::get_user_id_from_username($user); if ($user_id !== false) { $sql = "INSERT IGNORE INTO {$tbl_session_course_user} SET\n id_user='******',\n c_id = '{$courseId}',\n id_session = '{$session_id}'"; Database::query($sql); if ($debug) { $logger->addInfo("Sessions - Adding student: user #{$user_id} ({$user}) to course: '{$course_code}' and session #{$session_id}"); } $users_in_course_counter++; } else { $error_message .= get_lang('UserDoesNotExist') . ': ' . $user . $eol; } } $sql = "UPDATE {$tbl_session_course} SET nbr_users='{$users_in_course_counter}' WHERE c_id ='{$courseId}'"; Database::query($sql); $course_info = CourseManager::get_course_information($course_code); $inserted_in_course[$course_code] = $course_info['title']; } } $access_url_id = api_get_current_access_url_id(); UrlManager::add_session_to_url($session_id, $access_url_id); $sql_update_users = "UPDATE {$tbl_session} SET nbr_users ='{$user_counter}', nbr_courses='{$course_counter}' WHERE id='{$session_id}'"; Database::query($sql_update_users); } } return array('error_message' => $error_message, 'session_counter' => $session_counter); }
/** * This form will build a form to add users to an evaluation */ protected function build_add_user_to_eval() { $this->addElement('header', get_lang('ChooseUser')); $select = $this->addElement('select', 'firstLetterUser', get_lang('FirstLetter'), null, array('onchange' => 'document.add_users_to_evaluation.submit()')); $select->addOption('', ''); for ($i = 65; $i <= 90; $i++) { $letter = chr($i); if (isset($this->extra) && $this->extra == $letter) { $select->addOption($letter, $letter, 'selected'); } else { $select->addOption($letter, $letter); } } $select = $this->addElement('select', 'add_users', null, null, array('multiple' => 'multiple', 'size' => '15', 'style' => 'width:250px')); foreach ($this->evaluation_object->get_not_subscribed_students() as $user) { if (!isset($this->extra) || empty($this->extra) || api_strtoupper(api_substr($user[1], 0, 1)) == $this->extra) { $select->addoption($user[1] . ' ' . $user[2] . ' (' . $user[3] . ')', $user[0]); } } $this->addButtonCreate(get_lang('AddUserToEval'), 'submit_button'); }
$form->addElement('label', null, $preview); } } $form->addButtonCreate(get_lang('RegisterUser')); $course_code_redirect = Session::read('course_redirect'); if ($form->validate()) { $values = $form->getSubmitValues(1); // Make *sure* the login isn't too long if (isset($values['username'])) { $values['username'] = api_substr($values['username'], 0, USERNAME_MAX_LENGTH); } if (api_get_setting('registration.allow_registration_as_teacher') == 'false') { $values['status'] = STUDENT; } if (empty($values['official_code']) && !empty($values['username'])) { $values['official_code'] = api_strtoupper($values['username']); } if (api_get_setting('profile.login_is_email') == 'true') { $values['username'] = $values['email']; } if ($user_already_registered_show_terms && api_get_setting('registration.allow_terms_conditions') == 'true') { $user_id = $_SESSION['term_and_condition']['user_id']; $is_admin = UserManager::is_admin($user_id); Session::write('is_platformAdmin', $is_admin); } else { // Moved here to include extra fields when creating a user. Formerly placed after user creation // Register extra fields $extras = array(); foreach ($values as $key => $value) { if (substr($key, 0, 6) == 'extra_') { //an extra field
/** * Builds a person (full) name depending on the convention for a given language. * @param string $first_name The first name of the preson. * @param string $last_name The last name of the person. * @param string $title The title of the person. * @param int/string $format (optional) The person name format. It may be a pattern-string (for example '%t %l, %f' or '%T %F %L', ...) or some of the constants PERSON_NAME_COMMON_CONVENTION (default), PERSON_NAME_WESTERN_ORDER, PERSON_NAME_EASTERN_ORDER, PERSON_NAME_LIBRARY_ORDER. * @param string $language (optional) The language identificator. if it is omitted, the current interface language is assumed. This parameter has meaning with the format PERSON_NAME_COMMON_CONVENTION only. * @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default. * @return bool The result is sort of full name of the person. * Sample results: * Peter Ustinoff or Dr. Peter Ustinoff - the Western order * Ustinoff Peter or Dr. Ustinoff Peter - the Eastern order * Ustinoff, Peter or - Dr. Ustinoff, Peter - the library order * Note: See the file chamilo/main/inc/lib/internationalization_database/name_order_conventions.php where you can revise the convention for your language. * @author Carlos Vargas <*****@*****.**> - initial implementation. * @author Ivan Tcholakov */ function api_get_person_name($first_name, $last_name, $title = null, $format = null, $language = null, $encoding = null) { static $valid = array(); if (empty($format)) { $format = PERSON_NAME_COMMON_CONVENTION; } if (empty($language)) { $language = api_get_interface_language(false, true); } if (empty($encoding)) { $encoding = mb_internal_encoding(); } if (!isset($valid[$format][$language])) { if (is_int($format)) { switch ($format) { case PERSON_NAME_COMMON_CONVENTION: $valid[$format][$language] = _api_get_person_name_convention($language, 'format'); $usernameOrderFromDatabase = api_get_setting('display.user_name_order'); if (isset($usernameOrderFromDatabase) && !empty($usernameOrderFromDatabase)) { $valid[$format][$language] = $usernameOrderFromDatabase; } break; case PERSON_NAME_WESTERN_ORDER: $valid[$format][$language] = '%t %f %l'; break; case PERSON_NAME_EASTERN_ORDER: $valid[$format][$language] = '%t %l %f'; break; case PERSON_NAME_LIBRARY_ORDER: $valid[$format][$language] = '%t %l, %f'; break; default: $valid[$format][$language] = '%t %f %l'; break; } } else { $valid[$format][$language] = _api_validate_person_name_format($format); } } $format = $valid[$format][$language]; $person_name = str_replace(array('%f', '%l', '%t'), array($first_name, $last_name, $title), $format); if (strpos($format, '%F') !== false || strpos($format, '%L') !== false || strpos($format, '%T') !== false) { $person_name = str_replace(array('%F', '%L', '%T'), array(api_strtoupper($first_name, $encoding), api_strtoupper($last_name, $encoding), api_strtoupper($title, $encoding)), $person_name); } return _api_clean_person_name($person_name); }
} $data_table = array(); foreach ($data_array as $data) { $result = array(); $user_info = api_get_user_info($data['id']); $result[] = $user_info['username']; if (api_is_western_name_order()) { $result[] = $user_info['firstname'] . ', ' . $user_info['lastname']; } else { $result[] = $user_info['lastname'] . ', ' . $user_info['firstname']; } if ($number_decimals == null) { if (empty($data['scoreletter']) && !is_numeric($data['score'])) { $result[] = get_lang('DidNotTakeTheExam'); } else { $result[] = api_strtoupper(get_lang('Literal' . $data['scoreletter'])); } } else { if (empty($data['score']) && !is_numeric($data['score'])) { $result[] = get_lang('DidNotTakeTheExamAcronym'); } else { $result[] = $data['score']; } } if ($scoredisplay->is_custom()) { $result[] = $data['display']; } $data_table[] = $result; } export_pdf_with_html($head_table, $data_table, $header_pdf, $footer_pdf, $title_pdf); }
/** * Builds a person (full) name depending on the convention for a given language. * @param string $first_name The first name of the person. * @param string $last_name The last name of the person. * @param string $title The title of the person. * @param int/string $format (optional) The person name format. It may be a pattern-string (for example '%t %l, %f' or '%T %F %L', ...) or some of the constants PERSON_NAME_COMMON_CONVENTION (default), PERSON_NAME_WESTERN_ORDER, PERSON_NAME_EASTERN_ORDER, PERSON_NAME_LIBRARY_ORDER. * @param string $language (optional) The language id. If it is omitted, the current interface language is assumed. This parameter has meaning with the format PERSON_NAME_COMMON_CONVENTION only. * @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default. * @return bool The result is sort of full name of the person. * Sample results: * Peter Ustinoff or Dr. Peter Ustinoff - the Western order * Ustinoff Peter or Dr. Ustinoff Peter - the Eastern order * Ustinoff, Peter or - Dr. Ustinoff, Peter - the library order * Note: See the file chamilo/main/inc/lib/internationalization_database/name_order_conventions.php where you can revise the convention for your language. * @author Carlos Vargas <*****@*****.**> - initial implementation. * @author Ivan Tcholakov */ function api_get_person_name($first_name, $last_name, $title = null, $format = null, $language = null, $encoding = null, $username = null) { static $valid = array(); if (empty($format)) { $format = PERSON_NAME_COMMON_CONVENTION; } //We check if the language is supported, otherwise we check the interface language of the parent language of sublanguage if (empty($language)) { $language = api_get_interface_language(false, true); } if (!isset($valid[$format][$language])) { if (is_int($format)) { switch ($format) { case PERSON_NAME_COMMON_CONVENTION: $valid[$format][$language] = _api_get_person_name_convention($language, 'format'); $usernameOrderFromDatabase = api_get_setting('user_name_order'); if (isset($usernameOrderFromDatabase) && !empty($usernameOrderFromDatabase)) { $valid[$format][$language] = $usernameOrderFromDatabase; } break; case PERSON_NAME_WESTERN_ORDER: $valid[$format][$language] = '%t %f %l'; break; case PERSON_NAME_EASTERN_ORDER: $valid[$format][$language] = '%t %l %f'; break; case PERSON_NAME_LIBRARY_ORDER: $valid[$format][$language] = '%t %l, %f'; break; default: $valid[$format][$language] = '%t %f %l'; break; } } else { $valid[$format][$language] = _api_validate_person_name_format($format); } } $format = $valid[$format][$language]; $keywords = array('%firstname', '%f', '%F', '%lastname', '%l', '%L', '%title', '%t', '%T', '%username', '%u', '%U'); $values = array($first_name, $first_name, api_strtoupper($first_name), $last_name, $last_name, api_strtoupper($last_name), $title, $title, api_strtoupper($title), $username, $username, api_strtoupper($username)); $person_name = str_replace($keywords, $values, $format); return _api_clean_person_name($person_name); }
/** * @param FlatViewTable $flatviewtable * @param Category $cat * @param $users * @param $alleval * @param $alllinks * @param array $params * @param null $mainCourseCategory */ public static function export_pdf_flatview($flatviewtable, $cat, $users, $alleval, $alllinks, $params = array(), $mainCourseCategory = null) { // Getting data $printable_data = self::get_printable_data($cat[0], $users, $alleval, $alllinks, $params, $mainCourseCategory); // HTML report creation first $course_code = trim($cat[0]->get_course_code()); $displayscore = ScoreDisplay::instance(); $customdisplays = $displayscore->get_custom_score_display_settings(); $total = array(); if (is_array($customdisplays) && count($customdisplays)) { foreach ($customdisplays as $custom) { $total[$custom['display']] = 0; } $user_results = $flatviewtable->datagen->get_data_to_graph2(false); foreach ($user_results as $user_result) { $total[$user_result[count($user_result) - 1][1]]++; } } $parent_id = $cat[0]->get_parent_id(); if (isset($cat[0]) && isset($parent_id)) { if ($parent_id == 0) { $grade_model_id = $cat[0]->get_grade_model_id(); } else { $parent_cat = Category::load($parent_id); $grade_model_id = $parent_cat[0]->get_grade_model_id(); } } $use_grade_model = true; if (empty($grade_model_id) || $grade_model_id == -1) { $use_grade_model = false; } if ($use_grade_model) { if ($parent_id == 0) { $title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed'); } else { $title = api_strtoupper(get_lang('Average')) . '<br />' . $cat[0]->get_description() . ' - (' . $cat[0]->get_name() . ')'; } } else { if ($parent_id == 0) { $title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed'); } else { $title = api_strtoupper(get_lang('Average')); } } $columns = count($printable_data[0]); $has_data = is_array($printable_data[1]) && count($printable_data[1]) > 0; $table = new HTML_Table(array('class' => 'data_table')); $row = 0; $column = 0; $table->setHeaderContents($row, $column, get_lang('NumberAbbreviation')); $column++; foreach ($printable_data[0] as $printable_data_cell) { if (!is_array($printable_data_cell)) { $printable_data_cell = strip_tags($printable_data_cell); } $table->setHeaderContents($row, $column, $printable_data_cell); $column++; } $row++; if ($has_data) { $counter = 1; foreach ($printable_data[1] as &$printable_data_row) { $column = 0; $table->setCellContents($row, $column, $counter); $table->updateCellAttributes($row, $column, 'align="center"'); $column++; $counter++; foreach ($printable_data_row as $key => &$printable_data_cell) { $attributes = array(); $attributes['align'] = 'center'; $attributes['style'] = null; if ($key === 'name') { $attributes['align'] = 'left'; } if ($key === 'total') { $attributes['style'] = 'font-weight:bold'; } $table->setCellContents($row, $column, $printable_data_cell); $table->updateCellAttributes($row, $column, $attributes); $column++; } $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true); $row++; } } else { $column = 0; $table->setCellContents($row, $column, get_lang('NoResults')); $table->updateCellAttributes($row, $column, 'colspan="' . $columns . '" align="center" class="row_odd"'); } $pdfParams = array('filename' => get_lang('FlatView') . '_' . api_get_utc_datetime(), 'pdf_title' => $title, 'course_code' => $course_code, 'add_signatures' => true); $page_format = $params['orientation'] == 'landscape' ? 'A4-L' : 'A4'; $pdf = new PDF($page_format, $page_format, $pdfParams); $pdf->html_to_pdf_with_template($flatviewtable->return_table()); exit; }
/** * Get array containing column header names (incl user columns) * @param int $items_start Start item offset * @param int $items_count Number of items to get * @param bool $show_detail whether to show the details or not * @return array List of headers */ public function get_header_names($items_start = 0, $items_count = null, $show_detail = false) { $headers = array(); if (isset($this->params['show_official_code']) && $this->params['show_official_code']) { $headers[] = get_lang('OfficialCode'); } if (isset($this->params['join_firstname_lastname']) && $this->params['join_firstname_lastname']) { if (api_is_western_name_order()) { $headers[] = get_lang('FirstnameAndLastname'); } else { $headers[] = get_lang('LastnameAndFirstname'); } } else { if (api_is_western_name_order()) { $headers[] = get_lang('FirstName'); $headers[] = get_lang('LastName'); } else { $headers[] = get_lang('LastName'); $headers[] = get_lang('FirstName'); } } if (!isset($items_count)) { $items_count = count($this->evals_links) - $items_start; } $parent_id = $this->category->get_parent_id(); if ($parent_id == 0 || isset($this->params['only_subcat']) && $this->params['only_subcat'] == $this->category->get_id()) { $main_weight = $this->category->get_weight(); $grade_model_id = $this->category->get_grade_model_id(); } else { $main_cat = Category::load($parent_id, null, null); $main_weight = $main_cat[0]->get_weight(); $grade_model_id = $main_cat[0]->get_grade_model_id(); } $use_grade_model = true; if (empty($grade_model_id) || $grade_model_id == -1) { $use_grade_model = false; } //@todo move these in a function $sum_categories_weight_array = array(); $mainCategoryId = null; $mainCourseCategory = $this->getMainCourseCategory(); if (!empty($mainCourseCategory)) { $mainCategoryId = $mainCourseCategory->get_id(); } if (isset($this->category) && !empty($this->category)) { $categories = Category::load(null, null, null, $this->category->get_id()); if (!empty($categories)) { foreach ($categories as $category) { $sum_categories_weight_array[$category->get_id()] = $category->get_weight(); } } else { $sum_categories_weight_array[$this->category->get_id()] = $this->category->get_weight(); } } // No category was added $course_code = api_get_course_id(); $session_id = api_get_session_id(); $allcat = $this->category->get_subcategories(null, $course_code, $session_id, ['id' => 'ASC']); $evaluationsAdded = array(); if ($parent_id == 0 && !empty($allcat)) { // Means there are any subcategory foreach ($allcat as $sub_cat) { $sub_cat_weight = round(100 * $sub_cat->get_weight() / $main_weight, 1); $add_weight = " {$sub_cat_weight} %"; $mainHeader = Display::url($sub_cat->get_name(), api_get_self() . '?selectcat=' . $sub_cat->get_id() . '&' . api_get_cidreq()) . $add_weight; if (api_get_setting('gradebook.gradebook_detailed_admin_view') === 'true') { $links = $sub_cat->get_links(); $evaluations = $sub_cat->get_evaluations(); /** @var ExerciseLink $link */ $linkNameList = []; foreach ($links as $link) { $linkNameList[] = $link->get_name(); } $evalNameList = []; foreach ($evaluations as $evaluation) { $evalNameList[] = $evaluation->get_name(); } $finalList = array_merge($linkNameList, $evalNameList); if (!empty($finalList)) { $finalList[] = get_lang('Average'); } $list = []; $list['items'] = $finalList; $list['header'] = '<center>' . $mainHeader . '</center>'; $headers[] = $list; } else { $headers[] = '<center>' . $mainHeader . '</center>'; } } } else { if (!isset($this->params['only_total_category']) || isset($this->params['only_total_category']) && $this->params['only_total_category'] == false) { for ($count = 0; $count < $items_count && $items_start + $count < count($this->evals_links); $count++) { /** @var AbstractLink $item */ $item = $this->evals_links[$count + $items_start]; $weight = round(100 * $item->get_weight() / $main_weight, 1); $headers[] = $item->get_name() . ' ' . $weight . ' % '; $evaluationsAdded[] = $item->get_id(); } } } if (!empty($mainCategoryId)) { for ($count = 0; $count < $items_count && $items_start + $count < count($this->evals_links); $count++) { /** @var AbstractLink $item */ $item = $this->evals_links[$count + $items_start]; if ($mainCategoryId == $item->get_category_id() && !in_array($item->get_id(), $evaluationsAdded)) { $weight = round(100 * $item->get_weight() / $main_weight, 1); $headers[] = $item->get_name() . ' ' . $weight . ' % '; } } } $headers[] = '<center>' . api_strtoupper(get_lang('GradebookQualificationTotal')) . '</center>'; return $headers; }
/** * This function saves a new wiki page. * @author Patrick Cool <*****@*****.**>, Ghent University * @todo consider merging this with the function save_wiki into one single function. * @return string Message of success **/ public function save_new_wiki($values) { $tbl_wiki = $this->tbl_wiki; $tbl_wiki_conf = $this->tbl_wiki_conf; $assig_user_id = $this->assig_user_id; $_clean = array(); // cleaning the variables $_clean['assignment'] = ''; if (isset($values['assignment'])) { $_clean['assignment'] = $values['assignment']; } // session_id $session_id = api_get_session_id(); // Unlike ordinary pages of pages of assignments. // Allow create a ordinary page although there is a assignment with the same name if ($_clean['assignment'] == 2 || $_clean['assignment'] == 1) { $page = str_replace(' ', '_', $values['title'] . "_uass" . $assig_user_id); } else { $page = str_replace(' ', '_', $values['title']); } $_clean['reflink'] = $page; $_clean['title'] = trim($values['title']); $_clean['content'] = $values['content']; if (api_get_setting('editor.htmlpurifier_wiki') == 'true') { $purifier = new HTMLPurifier(); $_clean['content'] = $purifier->purify($_clean['content']); } //re-check after strip_tags if the title is empty if (empty($_clean['title']) || empty($_clean['reflink'])) { return false; } if ($_clean['assignment'] == 2) { //config by default for individual assignment (students) //Identifies the user as a creator, not the teacher who created $_clean['user_id'] = intval($assig_user_id); $_clean['visibility'] = 0; $_clean['visibility_disc'] = 0; $_clean['ratinglock_disc'] = 0; } else { $_clean['user_id'] = api_get_user_id(); $_clean['visibility'] = 1; $_clean['visibility_disc'] = 1; $_clean['ratinglock_disc'] = 1; } $_clean['comment'] = $values['comment']; $_clean['progress'] = $values['progress']; $_clean['version'] = 1; $groupId = api_get_group_id(); $_clean['linksto'] = self::links_to($_clean['content']); //check wikilinks // cleaning config variables $_clean['task'] = isset($values['task']) ? $values['task'] : ''; $_clean['feedback1'] = isset($values['feedback1']) ? $values['feedback1'] : ''; $_clean['feedback2'] = isset($values['feedback2']) ? $values['feedback2'] : ''; $_clean['feedback3'] = isset($values['feedback3']) ? $values['feedback3'] : ''; $_clean['fprogress1'] = isset($values['fprogress1']) ? $values['fprogress1'] : ''; $_clean['fprogress2'] = isset($values['fprogress2']) ? $values['fprogress2'] : ''; $_clean['fprogress3'] = isset($values['fprogress3']) ? $values['fprogress3'] : ''; if (isset($values['initstartdate']) && $values['initstartdate'] == 1) { $_clean['startdate_assig'] = $values['startdate_assig']; } else { $_clean['startdate_assig'] = '0000-00-00 00:00:00'; } if (isset($values['initenddate']) && $values['initenddate'] == 1) { $_clean['enddate_assig'] = $values['enddate_assig']; } else { $_clean['enddate_assig'] = '0000-00-00 00:00:00'; } $_clean['delayedsubmit'] = isset($values['delayedsubmit']) ? $values['delayedsubmit'] : ''; $_clean['max_text'] = isset($values['max_text']) ? $values['max_text'] : ''; $_clean['max_version'] = isset($values['max_version']) ? $values['max_version'] : ''; $course_id = api_get_course_int_id(); // Filter no _uass if (api_strtoupper(trim($values['title'])) == 'INDEX') { self::setMessage(Display::display_warning_message(get_lang('GoAndEditMainPage'), false, true)); } else { $var = $_clean['reflink']; $group_id = intval($_GET['group_id']); if (!self::checktitle($var)) { return get_lang('WikiPageTitleExist') . '<a href="index.php?action=edit&title=' . $var . '&group_id=' . $group_id . '&' . api_get_cidreq() . '">' . $values['title'] . '</a>'; } else { $dtime = api_get_utc_datetime(); $params = ['c_id' => $course_id, 'reflink' => $_clean['reflink'], 'title' => $_clean['title'], 'content' => $_clean['content'], 'user_id' => $_clean['user_id'], 'group_id' => $groupId, 'dtime' => $dtime, 'visibility' => $_clean['visibility'], 'visibility_disc' => $_clean['visibility_disc'], 'ratinglock_disc' => $_clean['ratinglock_disc'], 'assignment' => $_clean['assignment'], 'comment' => $_clean['comment'], 'progress' => $_clean['progress'], 'version' => $_clean['version'], 'linksto' => $_clean['linksto'], 'user_ip' => $_SERVER['REMOTE_ADDR'], 'session_id' => $session_id]; $Id = Database::insert($tbl_wiki, $params); if ($Id > 0) { $sql = "UPDATE {$tbl_wiki} SET id = iid WHERE iid = {$Id}"; Database::query($sql); //insert into item_property api_item_property_update(api_get_course_info(), TOOL_WIKI, $Id, 'WikiAdded', api_get_user_id(), $groupId); $sql = 'UPDATE ' . $tbl_wiki . ' SET page_id="' . $Id . '" WHERE c_id = ' . $course_id . ' AND id = "' . $Id . '"'; Database::query($sql); // insert wiki config $params = ['c_id' => $course_id, 'page_id' => $Id, 'task' => $_clean['task'], 'feedback1' => $_clean['feedback1'], 'feedback2' => $_clean['feedback2'], 'feedback3' => $_clean['feedback3'], 'fprogress1' => $_clean['fprogress1'], 'fprogress2' => $_clean['fprogress2'], 'fprogress3' => $_clean['fprogress3'], 'max_text' => $_clean['max_text'], 'max_version' => $_clean['max_version'], 'startdate_assig' => $_clean['startdate_assig'], 'enddate_assig' => $_clean['enddate_assig'], 'delayedsubmit' => $_clean['delayedsubmit']]; Database::insert($tbl_wiki_conf, $params); $this->setWikiData($Id); self::check_emailcue(0, 'A'); return get_lang('NewWikiSaved'); } } } }
/** * @param $score * @param $type * @return float|string */ private function display_default($score, $type) { switch ($type) { case SCORE_DIV: // X / Y return $this->display_as_div($score); case SCORE_PERCENT: // XX % return $this->display_as_percent($score); case SCORE_DIV_PERCENT: // X / Y (XX %) return $this->display_as_div($score) . ' (' . $this->display_as_percent($score) . ')'; case SCORE_AVERAGE: // XX % return $this->display_as_percent($score); case SCORE_DECIMAL: // 0.50 (X/Y) return $this->display_as_decimal($score); case SCORE_DIV_PERCENT_WITH_CUSTOM: // X / Y (XX %) - Good! $custom = $this->display_custom($score); if (!empty($custom)) { $custom = ' - ' . $custom; } return $this->display_as_div($score) . ' (' . $this->display_as_percent($score) . ')' . $custom; case SCORE_DIV_SIMPLE_WITH_CUSTOM: // X - Good! $custom = $this->display_custom($score); if (!empty($custom)) { $custom = ' - ' . $custom; } return $this->display_simple_score($score) . $custom; break; case SCORE_DIV_SIMPLE_WITH_CUSTOM_LETTERS: $custom = $this->display_custom($score); if (!empty($custom)) { $custom = ' - ' . $custom; } $score = $this->display_simple_score($score); //needs sudo apt-get install php5-intl if (class_exists('NumberFormatter')) { $iso = api_get_language_isocode(); $f = new NumberFormatter($iso, NumberFormatter::SPELLOUT); $letters = $f->format($score); $letters = api_strtoupper($letters); $letters = " ({$letters}) "; } return $score . $letters . $custom; break; case SCORE_CUSTOM: // Good! return $this->display_custom($score); } }
/** * This function saves a new wiki page. * @author Patrick Cool <*****@*****.**>, Ghent University * @todo consider merging this with the function save_wiki into one single function. * @return string Message of success **/ function save_new_wiki() { global $charset; global $tbl_wiki; global $assig_user_id; //need for assignments mode global $tbl_wiki_conf; global $page; // cleaning the variables $_clean['assignment'] = Database::escape_string($_POST['assignment']); // session_id $session_id = api_get_session_id(); if ($_clean['assignment'] == 2 || $_clean['assignment'] == 1) { // Unlike ordinary pages of pages of assignments. Allow create a ordinary page although there is a assignment with the same name $page = str_replace(' ', '_', $_POST['title'] . "_uass" . $assig_user_id); } else { $page = str_replace(' ', '_', $_POST['title']); } $_clean['reflink'] = Database::escape_string(strip_tags(api_htmlentities($page))); $_clean['title'] = Database::escape_string(strip_tags(trim($_POST['title']))); $_clean['content'] = Database::escape_string($_POST['content']); if (api_get_setting('htmlpurifier_wiki') == 'true') { $purifier = new HTMLPurifier(); $_clean['content'] = $purifier->purify($_clean['content']); } //re-check after strip_tags if the title is empty if (empty($_clean['title']) || empty($_clean['reflink'])) { return false; } if ($_clean['assignment'] == 2) { //config by default for individual assignment (students) $_clean['user_id'] = (int) Database::escape_string($assig_user_id); //Identifies the user as a creator, not the teacher who created $_clean['visibility'] = 0; $_clean['visibility_disc'] = 0; $_clean['ratinglock_disc'] = 0; } else { $_clean['user_id'] = api_get_user_id(); $_clean['visibility'] = 1; $_clean['visibility_disc'] = 1; $_clean['ratinglock_disc'] = 1; } $_clean['comment'] = Database::escape_string($_POST['comment']); $_clean['progress'] = Database::escape_string($_POST['progress']); $_clean['version'] = 1; if (isset($_SESSION['_gid'])) { $_clean['group_id'] = (int) $_SESSION['_gid']; } if (isset($_GET['group_id'])) { $_clean['group_id'] = (int) Database::escape_string($_GET['group_id']); } $_clean['linksto'] = links_to($_clean['content']); //check wikilinks //cleaning config variables $_clean['task'] = Database::escape_string($_POST['task']); $_clean['feedback1'] = Database::escape_string($_POST['feedback1']); $_clean['feedback2'] = Database::escape_string($_POST['feedback2']); $_clean['feedback3'] = Database::escape_string($_POST['feedback3']); $_clean['fprogress1'] = Database::escape_string($_POST['fprogress1']); $_clean['fprogress2'] = Database::escape_string($_POST['fprogress2']); $_clean['fprogress3'] = Database::escape_string($_POST['fprogress3']); if ($_POST['initstartdate'] == 1) { $_clean['startdate_assig'] = Database::escape_string(get_date_from_select('startdate_assig')); } else { $_clean['startdate_assig'] = Database::escape_string($_POST['startdate_assig']); } if ($_POST['initenddate'] == 1) { $_clean['enddate_assig'] = Database::escape_string(get_date_from_select('enddate_assig')); } else { $_clean['enddate_assig'] = Database::escape_string($_POST['enddate_assig']); } $_clean['delayedsubmit'] = Database::escape_string($_POST['delayedsubmit']); $_clean['max_text'] = Database::escape_string($_POST['max_text']); $_clean['max_version'] = Database::escape_string($_POST['max_version']); $course_id = api_get_course_int_id(); //filter no _uass if (api_eregi('_uass', $_POST['title']) || (api_strtoupper(trim($_POST['title'])) == 'INDEX' || api_strtoupper(trim(api_htmlentities($_POST['title'], ENT_QUOTES, $charset))) == api_strtoupper(api_htmlentities(get_lang('DefaultTitle'), ENT_QUOTES, $charset)))) { $message = get_lang('GoAndEditMainPage'); Display::display_warning_message($message, false); } else { $var = $_clean['reflink']; $group_id = Security::remove_XSS($_GET['group_id']); if (!checktitle($var)) { return get_lang('WikiPageTitleExist') . '<a href="index.php?action=edit&title=' . $var . '&group_id=' . $group_id . '">' . $_POST['title'] . '</a>'; } else { $dtime = date("Y-m-d H:i:s"); $sql = "INSERT INTO " . $tbl_wiki . " (c_id, reflink, title, content, user_id, group_id, dtime, visibility, visibility_disc, ratinglock_disc, assignment, comment, progress, version, linksto, user_ip, session_id) VALUES\n \t\t({$course_id}, '" . $_clean['reflink'] . "','" . $_clean['title'] . "','" . $_clean['content'] . "','" . $_clean['user_id'] . "','" . $_clean['group_id'] . "','" . $dtime . "','" . $_clean['visibility'] . "','" . $_clean['visibility_disc'] . "','" . $_clean['ratinglock_disc'] . "','" . $_clean['assignment'] . "','" . $_clean['comment'] . "','" . $_clean['progress'] . "','" . $_clean['version'] . "','" . $_clean['linksto'] . "','" . Database::escape_string($_SERVER['REMOTE_ADDR']) . "', '" . Database::escape_string($session_id) . "')"; $result = Database::query($sql); $Id = Database::insert_id(); if ($Id > 0) { //insert into item_property api_item_property_update(api_get_course_info(), TOOL_WIKI, $Id, 'WikiAdded', api_get_user_id(), $_clean['group_id']); } $sql = 'UPDATE ' . $tbl_wiki . ' SET page_id="' . $Id . '" WHERE c_id = ' . $course_id . ' AND id="' . $Id . '"'; Database::query($sql); //insert wiki config $sql = "INSERT INTO " . $tbl_wiki_conf . " (c_id, page_id, task, feedback1, feedback2, feedback3, fprogress1, fprogress2, fprogress3, max_text, max_version, startdate_assig, enddate_assig, delayedsubmit) VALUES\n \t\t({$course_id}, '" . $Id . "','" . $_clean['task'] . "','" . $_clean['feedback1'] . "','" . $_clean['feedback2'] . "','" . $_clean['feedback3'] . "','" . $_clean['fprogress1'] . "','" . $_clean['fprogress2'] . "','" . $_clean['fprogress3'] . "','" . $_clean['max_text'] . "','" . $_clean['max_version'] . "','" . $_clean['startdate_assig'] . "','" . $_clean['enddate_assig'] . "','" . $_clean['delayedsubmit'] . "')"; Database::query($sql); check_emailcue(0, 'A'); return get_lang('NewWikiSaved'); } } //end filter no _uass }
/** * Makes a string's first character uppercase. * @param string $string The input string. * @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default. * @return string Returns a string with the first character capitalized, if that character is alphabetic. * This function is aimed at replacing the function ucfirst() for human-language strings. * @link http://php.net/manual/en/function.ucfirst */ function api_ucfirst($string, $encoding = null) { if (empty($encoding)) { $encoding = _api_mb_internal_encoding(); } return api_strtoupper(api_substr($string, 0, 1, $encoding), $encoding) . api_substr($string, 1, api_strlen($string, $encoding), $encoding); }