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


PHP Display::label方法代码示例

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


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

示例1: hookResubscribe

 /**
  * Limit session resubscription when a Chamilo user is resubscribed to a session
  * @param HookCreateUserEventInterface $hook The hook
  */
 public function hookResubscribe(HookResubscribeEventInterface $hook)
 {
     $data = $hook->getEventData();
     if ($data['type'] === HOOK_EVENT_TYPE_PRE) {
         $resubscriptionLimit = Resubscription::create()->get('resubscription_limit');
         // Initialize variables as a calendar year by default
         $limitDateFormat = 'Y-01-01';
         $limitDate = gmdate($limitDateFormat);
         $resubscriptionOffset = "1 year";
         // No need to use a 'switch' with only two options so an 'if' is enough.
         // However this could change if the number of options increases
         if ($resubscriptionLimit === 'natural_year') {
             $limitDateFormat = 'Y-m-d';
             $limitDate = gmdate($limitDateFormat);
             $limitDate = gmdate($limitDateFormat, strtotime("{$limitDate} -{$resubscriptionOffset}"));
         }
         $join = " INNER JOIN " . Database::get_main_table(TABLE_MAIN_SESSION) . "ON id = session_id";
         // User sessions and courses
         $userSessions = Database::select('session_id, date_end', Database::get_main_table(TABLE_MAIN_SESSION_USER) . $join, array('where' => array('user_id = ? AND date_end >= ?' => array(api_get_user_id(), $limitDate)), 'order' => 'date_end DESC'));
         $userSessionCourses = array();
         foreach ($userSessions as $userSession) {
             $userSessionCourseResult = Database::select('c_id', Database::get_main_table(TABLE_MAIN_SESSION_COURSE), array('where' => array('session_id = ?' => array($userSession['session_id']))));
             foreach ($userSessionCourseResult as $userSessionCourse) {
                 if (!isset($userSessionCourses[$userSessionCourse['c_id']])) {
                     $userSessionCourses[$userSessionCourse['c_id']] = $userSession['date_end'];
                 }
             }
         }
         // Current session and courses
         $currentSessionCourseResult = Database::select('c_id', Database::get_main_table(TABLE_MAIN_SESSION_COURSE), array('where' => array('session_id = ?' => array($data['session_id']))));
         // Check if current course code matches with one of the users
         foreach ($currentSessionCourseResult as $currentSessionCourse) {
             if (isset($userSessionCourses[$currentSessionCourse['c_id']])) {
                 $endDate = $userSessionCourses[$currentSessionCourse['c_id']];
                 $resubscriptionDate = gmdate($limitDateFormat, strtotime($endDate . " +{$resubscriptionOffset}"));
                 $icon = Display::return_icon('students.gif', get_lang('Student'));
                 $canResubscribeFrom = sprintf(get_plugin_lang('CanResubscribeFromX', 'resubscription'), $resubscriptionDate);
                 throw new Exception(Display::label($icon . ' ' . $canResubscribeFrom, "info"));
             }
         }
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:46,代码来源:HookResubscription.php

示例2: get_course_data

/**
 * Get course data to display
 */
function get_course_data($from, $number_of_items, $column, $direction)
{
    $course_table = Database::get_main_table(TABLE_MAIN_COURSE);
    $sql = "SELECT  code AS col0,\n                    title AS col1,\n                    code AS col2,\n                    course_language AS col3,\n                    category_code AS col4,\n                    subscribe AS col5,\n                    unsubscribe AS col6,\n                    code AS col7,\n                    visibility AS col8,\n                    directory as col9,\n                    visual_code\n    \t\tFROM {$course_table} course";
    if ((api_is_platform_admin() || api_is_session_admin()) && api_is_multiple_url_enabled() && api_get_current_access_url_id() != -1) {
        $access_url_rel_course_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
        $sql .= " INNER JOIN {$access_url_rel_course_table} url_rel_course ON (course.id = url_rel_course.c_id)";
    }
    if (isset($_GET['keyword'])) {
        $keyword = Database::escape_string(trim($_GET['keyword']));
        $sql .= " WHERE (title LIKE '%" . $keyword . "%' OR code LIKE '%" . $keyword . "%' OR visual_code LIKE '%" . $keyword . "%' ) ";
    } elseif (isset($_GET['keyword_code'])) {
        $keyword_code = Database::escape_string($_GET['keyword_code']);
        $keyword_title = Database::escape_string($_GET['keyword_title']);
        $keyword_category = Database::escape_string($_GET['keyword_category']);
        $keyword_language = Database::escape_string($_GET['keyword_language']);
        $keyword_visibility = Database::escape_string($_GET['keyword_visibility']);
        $keyword_subscribe = Database::escape_string($_GET['keyword_subscribe']);
        $keyword_unsubscribe = Database::escape_string($_GET['keyword_unsubscribe']);
        $sql .= " WHERE (code LIKE '%" . $keyword_code . "%' OR visual_code LIKE '%" . $keyword_code . "%') AND title LIKE '%" . $keyword_title . "%' AND category_code LIKE '%" . $keyword_category . "%'  AND course_language LIKE '%" . $keyword_language . "%'   AND visibility LIKE '%" . $keyword_visibility . "%'    AND subscribe LIKE '" . $keyword_subscribe . "'AND unsubscribe LIKE '" . $keyword_unsubscribe . "'";
    }
    // Adding the filter to see the user's only of the current access_url.
    if ((api_is_platform_admin() || api_is_session_admin()) && api_is_multiple_url_enabled() && api_get_current_access_url_id() != -1) {
        $sql .= " AND url_rel_course.access_url_id=" . api_get_current_access_url_id();
    }
    $sql .= " ORDER BY col{$column} {$direction} ";
    $sql .= " LIMIT {$from},{$number_of_items}";
    $res = Database::query($sql);
    $courses = array();
    while ($course = Database::fetch_array($res)) {
        // Place colour icons in front of courses.
        $show_visual_code = $course['visual_code'] != $course[2] ? Display::label($course['visual_code'], 'info') : null;
        $course[1] = get_course_visibility_icon($course[8]) . '<a href="' . api_get_path(WEB_COURSE_PATH) . $course[9] . '/index.php">' . $course[1] . '</a> ' . $show_visual_code;
        $course[5] = $course[5] == SUBSCRIBE_ALLOWED ? get_lang('Yes') : get_lang('No');
        $course[6] = $course[6] == UNSUBSCRIBE_ALLOWED ? get_lang('Yes') : get_lang('No');
        $course_rem = array($course[0], $course[1], $course[2], $course[3], $course[4], $course[5], $course[6], $course[7]);
        $courses[] = $course_rem;
    }
    return $courses;
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:43,代码来源:course_list.php

示例3: indexAction


//.........这里部分代码省略.........
                 $item['actions'] .= Display::url(Display::return_icon('delete.png', get_lang('Delete')), api_get_path(WEB_CODE_PATH) . 'timeline/?action=delete&id=' . $item['id']);
                 $new_result[] = $item;
             }
             $result = $new_result;
             break;
         case 'get_gradebooks':
             $columns = array('name', 'certificates', 'skills', 'actions', 'has_certificates');
             if (!in_array($sidx, $columns)) {
                 $sidx = 'name';
             }
             $result = Database::select('*', $obj->table, array('order' => "{$sidx} {$sord}", 'LIMIT' => "{$start} , {$limit}"));
             $new_result = array();
             foreach ($result as $item) {
                 if ($item['parent_id'] != 0) {
                     continue;
                 }
                 $skills = $obj->get_skills_by_gradebook($item['id']);
                 //Fixes bug when gradebook doesn't have names
                 if (empty($item['name'])) {
                     $item['name'] = $item['course_code'];
                 } else {
                     //$item['name'] =  $item['name'].' ['.$item['course_code'].']';
                 }
                 $item['name'] = Display::url($item['name'], api_get_path(WEB_CODE_PATH) . 'gradebook/index.php?id_session=0&cidReq=' . $item['course_code']);
                 if (!empty($item['certif_min_score']) && !empty($item['document_id'])) {
                     $item['certificates'] = Display::return_icon('accept.png', get_lang('WithCertificate'), array(), ICON_SIZE_SMALL);
                     $item['has_certificates'] = '1';
                 } else {
                     $item['certificates'] = Display::return_icon('warning.png', get_lang('NoCertificate'), array(), ICON_SIZE_SMALL);
                     $item['has_certificates'] = '0';
                 }
                 if (!empty($skills)) {
                     foreach ($skills as $skill) {
                         $item['skills'] .= Display::span($skill['name'], array('class' => 'label_tag skill'));
                     }
                 }
                 $new_result[] = $item;
             }
             $result = $new_result;
             break;
         case 'get_event_email_template':
             $columns = array('subject', 'event_type_name', 'language_id', 'activated', 'actions');
             if (!in_array($sidx, $columns)) {
                 $sidx = 'subject';
             }
             $result = Database::select('*', $obj->table, array('order' => "{$sidx} {$sord}", 'LIMIT' => "{$start} , {$limit}"));
             $new_result = array();
             foreach ($result as $item) {
                 $language_info = api_get_language_info($item['language_id']);
                 $item['language_id'] = $language_info['english_name'];
                 $item['actions'] = Display::url(Display::return_icon('edit.png', get_lang('Edit')), api_get_path(WEB_CODE_PATH) . 'admin/event_type.php?action=edit&event_type_name=' . $item['event_type_name']);
                 $item['actions'] .= Display::url(Display::return_icon('delete.png', get_lang('Delete')), api_get_path(WEB_CODE_PATH) . 'admin/event_controller.php?action=delete&id=' . $item['id']);
                 /*if (!$item['status']) {
                       $item['name'] = '<font style="color:#AAA">'.$item['subject'].'</font>';
                   }*/
                 $new_result[] = $item;
             }
             $result = $new_result;
             break;
         case 'get_careers':
             $columns = array('name', 'description', 'actions');
             if (!in_array($sidx, $columns)) {
                 $sidx = 'name';
             }
             $result = Database::select('*', $obj->table, array('order' => "{$sidx} {$sord}", 'LIMIT' => "{$start} , {$limit}"));
             $new_result = array();
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:67,代码来源:ModelAjaxController.php

示例4: draw_category_label

 /**
  * @param array $category_list
  * @param string $type
  * @return null|string
  */
 public static function draw_category_label($category_list, $type = 'label')
 {
     $new_category_list = array();
     foreach ($category_list as $category) {
         $category_name = $category['title'];
         $category_name_cut = Text::cut($category['title'], 20);
         switch ($type) {
             case 'label':
                 // Global cat
                 /*
                                     $parentId = isset($category['parent_id']) && !empty($category['parent_id']) ? $category['parent_id'] : null;
                                     if (empty($parentId)) {
                                         $new_category_list[] = Display::label($category_name, 'info');
                                     } else {
                                         // Local cat
                                         $new_category_list[] = Display::label($category_name, 'success');
                                     }*/
                 $courseId = isset($category['c_id']) && !empty($category['c_id']) ? $category['c_id'] : null;
                 if (empty($courseId)) {
                     $new_category_list[] = Display::label($category_name_cut, 'info', $category_name);
                 } else {
                     // Local cat
                     $new_category_list[] = Display::label($category_name_cut, 'success', $category_name);
                 }
                 break;
             case 'header':
                 $new_category_list[] = $category_name;
                 break;
         }
     }
     $html = null;
     if (!empty($new_category_list)) {
         switch ($type) {
             case 'label':
                 $html = implode(' ', $new_category_list);
                 break;
             case 'header':
                 $html = Display::page_subheader3(get_lang('Category') . ': ' . implode(', ', $new_category_list));
                 break;
         }
     }
     return $html;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:48,代码来源:testcategory.class.php

示例5: build_name_link

 /**
  * Generate name column
  * @param unknown_type $item
  * @return string
  */
 private function build_name_link($item)
 {
     $view = isset($_GET['view']) ? Security::remove_XSS($_GET['view']) : null;
     //$session_id = api_get_session_id();
     switch ($item->get_item_type()) {
         // category
         case 'C':
             $prms_uri = '?selectcat=' . $item->get_id() . '&amp;view=' . Security::remove_XSS($_GET['view']);
             if (isset($_GET['isStudentView'])) {
                 if (isset($is_student) || isset($_SESSION['studentview']) && $_SESSION['studentview'] == 'studentview') {
                     $prms_uri = $prms_uri . '&amp;isStudentView=' . Security::remove_XSS($_GET['isStudentView']);
                 }
             }
             $cat = new Category();
             $show_message = $cat->show_message_resource_delete($item->get_course_code());
             return '&nbsp;<a href="' . Security::remove_XSS($_SESSION['gradebook_dest']) . $prms_uri . '">' . $item->get_name() . '</a>' . ($item->is_course() ? ' &nbsp;[' . $item->get_course_code() . ']' . $show_message : '');
             // evaluation
         // evaluation
         case 'E':
             $cat = new Category();
             $course_id = CourseManager::get_course_by_category($_GET['selectcat']);
             $show_message = $cat->show_message_resource_delete($course_id);
             // course/platform admin can go to the view_results page
             if (api_is_allowed_to_edit() && $show_message === false) {
                 if ($item->get_type() == 'presence') {
                     return '&nbsp;' . '<a href="gradebook_view_result.php?cidReq=' . $course_id . '&amp;selecteval=' . $item->get_id() . '">' . $item->get_name() . '</a>';
                 } else {
                     return '&nbsp;' . '<a href="gradebook_view_result.php?cidReq=' . $course_id . '&amp;selecteval=' . $item->get_id() . '">' . $item->get_name() . '</a>&nbsp;' . Display::label(get_lang('Evaluation'));
                 }
             } elseif (ScoreDisplay::instance()->is_custom() && $show_message === false) {
                 // students can go to the statistics page (if custom display enabled)
                 return '&nbsp;' . '<a href="gradebook_statistics.php?selecteval=' . $item->get_id() . '">' . $item->get_name() . '</a>';
             } elseif ($show_message === false && !api_is_allowed_to_edit() && !ScoreDisplay::instance()->is_custom()) {
                 return '&nbsp;' . '<a href="gradebook_statistics.php?selecteval=' . $item->get_id() . '">' . $item->get_name() . '</a>';
             } else {
                 return '[' . get_lang('Evaluation') . ']&nbsp;&nbsp;' . $item->get_name() . $show_message;
             }
             // link
         // link
         case 'L':
             $cat = new Category();
             $course_id = CourseManager::get_course_by_category($_GET['selectcat']);
             $show_message = $cat->show_message_resource_delete($course_id);
             $url = $item->get_link();
             if (isset($url) && $show_message === false) {
                 $text = '&nbsp;<a href="' . $item->get_link() . '">' . $item->get_name() . '</a>';
             } else {
                 $text = $item->get_name();
             }
             $text .= "&nbsp;" . Display::label($item->get_type_name(), 'info') . $show_message;
             $cc = $this->currentcat->get_course_code();
             if (empty($cc)) {
                 $text .= '&nbsp;[<a href="' . api_get_path(REL_COURSE_PATH) . $item->get_course_code() . '/">' . $item->get_course_code() . '</a>]';
             }
             return $text;
     }
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:62,代码来源:gradebooktable.class.php

示例6: api_get_cidreq

             $url = 'class.php?action=remove_class_from_course&id=' . $group['id'] . '&' . api_get_cidreq();
             $icon = Display::return_icon('delete.png', get_lang('Remove'));
             //$class = 'btn btn-danger';
             //$text = get_lang('Remove');
         } else {
             $url = 'class.php?action=add_class_to_course&id=' . $group['id'] . '&' . api_get_cidreq() . '&type=not_registered';
             //$class = 'btn btn-primary';
             $icon = Display::return_icon('add.png', get_lang('Add'));
             //$text = get_lang('Add');
         }
         switch ($group['group_type']) {
             case 0:
                 $group['group_type'] = Display::label(get_lang('Class'), 'primary');
                 break;
             case 1:
                 $group['group_type'] = Display::label(get_lang('Social'), 'success');
                 break;
         }
         $role = $obj->getUserRoleToString(api_get_user_id(), $group['id']);
         $group['status'] = $role;
         $group['actions'] = Display::url($icon, $url);
         $new_result[] = $group;
     }
     $result = $new_result;
 }
 if (!in_array($sidx, $columns)) {
     $sidx = 'name';
 }
 // Multidimensional sort
 $result = ArrayClass::msort($result, $sidx, $sord);
 break;
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:model.ajax.php

示例7: display_messages_for_group

 /**
  * Displays messages of a group with nested view
  *
  * @param int $group_id
  */
 public static function display_messages_for_group($group_id)
 {
     global $my_group_role;
     $rows = self::get_messages_by_group($group_id);
     $topics_per_page = 10;
     $html_messages = '';
     $query_vars = array('id' => $group_id, 'topics_page_nr' => 0);
     if (is_array($rows) && count($rows) > 0) {
         // prepare array for topics with its items
         $topics = array();
         $x = 0;
         foreach ($rows as $index => $value) {
             if (empty($value['parent_id'])) {
                 $topics[$value['id']] = $value;
             }
         }
         $new_topics = array();
         foreach ($topics as $id => $value) {
             $rows = null;
             $rows = self::get_messages_by_group_by_message($group_id, $value['id']);
             if (!empty($rows)) {
                 $count = count(self::calculate_children($rows, $value['id']));
             } else {
                 $count = 0;
             }
             $value['count'] = $count;
             $new_topics[$id] = $value;
         }
         $array_html = array();
         foreach ($new_topics as $index => $topic) {
             $html = '';
             // topics
             $user_sender_info = api_get_user_info($topic['user_sender_id']);
             $name = $user_sender_info['complete_name'];
             $html .= '<div class="row">';
             $items = $topic['count'];
             $reply_label = $items == 1 ? get_lang('GroupReply') : get_lang('GroupReplies');
             $label = Display::label($items . ' ' . $reply_label);
             $topic['title'] = trim($topic['title']);
             if (empty($topic['title'])) {
                 $topic['title'] = get_lang('Untitled');
             }
             $html .= '<div class="col-md-8">';
             $html .= Display::tag('h4', Display::url(Security::remove_XSS($topic['title'], STUDENT, true), api_get_path(WEB_CODE_PATH) . 'social/group_topics.php?id=' . $group_id . '&topic_id=' . $topic['id']));
             $actions = '';
             if ($my_group_role == GROUP_USER_PERMISSION_ADMIN || $my_group_role == GROUP_USER_PERMISSION_MODERATOR) {
                 $actions = '<br />' . Display::url(get_lang('Delete'), api_get_path(WEB_CODE_PATH) . 'social/group_topics.php?action=delete&id=' . $group_id . '&topic_id=' . $topic['id'], array('class' => 'btn btn-default'));
             }
             $date = '';
             if ($topic['send_date'] != $topic['update_date']) {
                 if (!empty($topic['update_date']) && $topic['update_date'] != '0000-00-00 00:00:00') {
                     $date .= '<div class="message-group-date" > <i>' . get_lang('LastUpdate') . ' ' . date_to_str_ago($topic['update_date']) . '</i></div>';
                 }
             } else {
                 $date .= '<div class="message-group-date"> <i>' . get_lang('Created') . ' ' . date_to_str_ago($topic['send_date']) . '</i></div>';
             }
             $html .= $date . $label . $actions;
             $html .= '</div>';
             $image = $user_sender_info['avatar'];
             $user_info = '<td valign="top"><a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $topic['user_sender_id'] . '">' . $name . '&nbsp;</a>';
             $user_info .= '<div class="message-group-author"><img src="' . $image . '" alt="' . $name . '"  width="32" height="32" title="' . $name . '" /></div>';
             $user_info .= '</td>';
             $html .= '<div class="col-md-2">';
             $html .= $user_info;
             $html .= '</div>';
             $html .= '</div>';
             $array_html[] = array($html);
         }
         // grids for items and topics  with paginations
         $html_messages .= Display::return_sortable_grid('topics', array(), $array_html, array('hide_navigation' => false, 'per_page' => $topics_per_page), $query_vars, false, array(true, true, true, false), false);
     }
     return $html_messages;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:78,代码来源:message.lib.php

示例8: foreach

$sql = 'SELECT * FROM ' . $table_evaluation . ' WHERE category_id = ' . $my_selectcat;
$result = Database::query($sql);
$evaluations = Database::store_result($result);
foreach ($evaluations as $evaluationRow) {
    $item_weight = $evaluationRow['weight'];
    //$item_weight = $masked_total*$item_weight/$original_total;
    //update only if value changed
    if (isset($_POST['evaluation'][$evaluationRow['id']])) {
        //$new_weight = trim($_POST['evaluation'][$evaluationRow['id']]*$original_total/$masked_total);
        $new_weight = trim($_POST['evaluation'][$evaluationRow['id']]);
        GradebookUtils::updateEvaluationWeight($evaluationRow['id'], $new_weight);
        $item_weight = $new_weight;
    }
    $output .= '<tr>
                <td>' . GradebookUtils::build_type_icon_tag('evalnotempty') . '</td>
                <td>' . $evaluationRow['name'] . ' ' . Display::label(get_lang('Evaluation')) . '</td>';
    $output .= '<td>
                    <input type="hidden" name="eval_' . $evaluationRow['id'] . '" value="' . $evaluationRow['name'] . '" />
                    <input type="text" size="10" name="evaluation[' . $evaluationRow['id'] . ']" value="' . $item_weight . '"/>
                </td></tr>';
}
$my_api_cidreq = api_get_cidreq();
if ($my_api_cidreq == '') {
    $my_api_cidreq = 'cidReq=' . $my_category['course_code'];
}
$currentUrl = api_get_self() . '?' . api_get_cidreq() . '&selectcat=' . $my_selectcat;
$form = new FormValidator('auto_weight', 'post', $currentUrl);
$form->addHeader(get_lang('AutoWeight'));
$form->addLabel(null, get_lang('AutoWeightExplanation'));
$form->addButtonUpdate(get_lang('AutoWeight'));
if ($form->validate()) {
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:gradebook_edit_all.php

示例9: get_exam_results_data


//.........这里部分代码省略.........
                     }
                     $results[$i]['group_name'] = $group_name_list;
                 }
                 $results[$i]['exe_duration'] = !empty($results[$i]['exe_duration']) ? round($results[$i]['exe_duration'] / 60) : 0;
                 $user_list_id[] = $results[$i]['exe_user_id'];
                 $id = $results[$i]['exe_id'];
                 $dt = api_convert_and_format_date($results[$i]['exe_weighting']);
                 // we filter the results if we have the permission to
                 if (isset($results[$i]['results_disabled'])) {
                     $result_disabled = intval($results[$i]['results_disabled']);
                 } else {
                     $result_disabled = 0;
                 }
                 if ($result_disabled == 0) {
                     $my_res = $results[$i]['exe_result'];
                     $my_total = $results[$i]['exe_weighting'];
                     $results[$i]['start_date'] = api_get_local_time($results[$i]['start_date']);
                     $results[$i]['exe_date'] = api_get_local_time($results[$i]['exe_date']);
                     if (!$results[$i]['propagate_neg'] && $my_res < 0) {
                         $my_res = 0;
                     }
                     $score = self::show_score($my_res, $my_total);
                     $actions = '';
                     if ($is_allowedToEdit) {
                         if (isset($teacher_id_list)) {
                             if (in_array($results[$i]['exe_user_id'], $teacher_id_list)) {
                                 $actions .= Display::return_icon('teachers.gif', get_lang('Teacher'));
                             }
                         }
                         if ($revised) {
                             $actions .= "<a href='exercise_show.php?" . api_get_cidreq() . "&action=edit&id={$id}'>" . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL);
                             $actions .= '&nbsp;';
                         } else {
                             $actions .= "<a href='exercise_show.php?" . api_get_cidreq() . "&action=qualify&id={$id}'>" . Display::return_icon('quiz.gif', get_lang('Qualify'));
                             $actions .= '&nbsp;';
                         }
                         $actions .= "</a>";
                         if ($filter == 2) {
                             $actions .= ' <a href="exercise_history.php?' . api_get_cidreq() . '&exe_id=' . $id . '">' . Display::return_icon('history.gif', get_lang('ViewHistoryChange')) . '</a>';
                         }
                         //Admin can always delete the attempt
                         if (($locked == false || api_is_platform_admin()) && !api_is_student_boss()) {
                             $ip = TrackingUserLog::get_ip_from_user_event($results[$i]['exe_user_id'], date('Y-m-d h:i:s'), false);
                             $actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip=' . $ip . '" target="_blank">';
                             $actions .= Display::return_icon('info.png', $ip, ['title' => $ip]);
                             $actions .= '</a>';
                             $delete_link = '<a href="exercise_report.php?' . api_get_cidreq() . '&filter_by_user=' . intval($_GET['filter_by_user']) . '&filter=' . $filter . '&exerciseId=' . $exercise_id . '&delete=delete&did=' . $id . '"
                             onclick="javascript:if(!confirm(\'' . sprintf(get_lang('DeleteAttempt'), $results[$i]['username'], $dt) . '\')) return false;">' . Display::return_icon('delete.png', get_lang('Delete')) . '</a>';
                             $delete_link = utf8_encode($delete_link);
                             if (api_is_drh() && !api_is_platform_admin()) {
                                 $delete_link = null;
                             }
                             $actions .= $delete_link . '&nbsp;';
                         }
                     } else {
                         $attempt_url = api_get_path(WEB_CODE_PATH) . 'exercice/result.php?' . api_get_cidreq() . '&id=' . $results[$i]['exe_id'] . '&id_session=' . $sessionId;
                         $attempt_link = Display::url(get_lang('Show'), $attempt_url, ['class' => 'ajax btn btn-default', 'data-title' => get_lang('Show')]);
                         $actions .= $attempt_link;
                     }
                     if ($revised) {
                         $revised = Display::label(get_lang('Validated'), 'success');
                     } else {
                         $revised = Display::label(get_lang('NotValidated'), 'info');
                     }
                     if ($is_allowedToEdit) {
                         $results[$i]['status'] = $revised;
                         $results[$i]['score'] = $score;
                         $results[$i]['lp'] = $lp_name;
                         $results[$i]['actions'] = $actions;
                         $list_info[] = $results[$i];
                     } else {
                         $results[$i]['status'] = $revised;
                         $results[$i]['score'] = $score;
                         $results[$i]['actions'] = $actions;
                         $list_info[] = $results[$i];
                     }
                 }
             }
         }
     } else {
         $hpresults = StatsUtils::getManyResultsXCol($hpsql, 6);
         // Print HotPotatoes test results.
         if (is_array($hpresults)) {
             for ($i = 0; $i < sizeof($hpresults); $i++) {
                 $hp_title = GetQuizName($hpresults[$i][3], $documentPath);
                 if ($hp_title == '') {
                     $hp_title = basename($hpresults[$i][3]);
                 }
                 $hp_date = api_get_local_time($hpresults[$i][6], null, date_default_timezone_get());
                 $hp_result = round($hpresults[$i][4] / ($hpresults[$i][5] != 0 ? $hpresults[$i][5] : 1) * 100, 2) . '% (' . $hpresults[$i][4] . ' / ' . $hpresults[$i][5] . ')';
                 if ($is_allowedToEdit) {
                     $list_info[] = array($hpresults[$i][0], $hpresults[$i][1], $hpresults[$i][2], '', $hp_title, '-', $hp_date, $hp_result, '-');
                 } else {
                     $list_info[] = array($hp_title, '-', $hp_date, $hp_result, '-');
                 }
             }
         }
     }
     return $list_info;
 }
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:101,代码来源:exercise.lib.php

示例10: api_get_course_url

        // Go To Course button (only if admin, if course public or if student already subscribed)
        if ($access_type && in_array('enter', $access_type)) {
            echo ' <a class="btn btn-primary" href="' . api_get_course_url($course['code']) . '">' . get_lang('GoToCourse') . '</a>';
        }
        // Register button
        if ($access_type && in_array('register', $access_type)) {
            echo ' <a class="btn btn-primary" href="' . api_get_self() . '?action=subscribe_course&amp;sec_token=' . $stok . '&amp;subscribe_course=' . $course['code'] . '&amp;search_term=' . $search_term . '&amp;category_code=' . $code . '">' . get_lang('Subscribe') . '</a>';
        }
        // If user is already subscribed to the course
        if (!api_is_anonymous() && in_array($course['code'], $user_coursecodes)) {
            if ($course['unsubscribe'] == UNSUBSCRIBE_ALLOWED) {
                echo ' <a class="btn btn-primary" href="' . api_get_self() . '?action=unsubscribe&amp;sec_token=' . $stok . '&amp;unsubscribe=' . $course['code'] . '&amp;search_term=' . $search_term . '&amp;category_code=' . $code . '">' . get_lang('Unsubscribe') . '</a>';
            }
            echo '<br />';
            echo '<br />';
            echo Display::label(get_lang("AlreadyRegisteredToCourse"), "info");
        }
        echo '</div>';
        echo '</p>';
        echo '</div>';
        echo '<div class="col-md-2">';
        echo '<div class="course-block-popularity"><span>' . get_lang('ConnectionsLastMonth') . '</span><div class="course-block-popularity-score">' . $count_connections . '</div></div>';
        echo '</div>';
        echo '</div></div>';
    }
} else {
    if (!isset($_REQUEST['subscribe_user_with_password']) && !isset($_REQUEST['subscribe_course'])) {
        echo Display::display_warning_message(get_lang('ThereAreNoCoursesInThisCategory'));
    }
}
?>
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:courses_categories.php

示例11: foreach

$btn_class = 'ajax ';
if ($current_browser == 'Internet Explorer') {
    $url_suffix = '&amp;show_headers=1';
    $btn_class = '';
}
if (!empty($attempts)) {
    $i = $counter;
    foreach ($attempts as $attempt_result) {
        $score = ExerciseLib::show_score($attempt_result['exe_result'], $attempt_result['exe_weighting']);
        $attempt_url = api_get_path(WEB_CODE_PATH) . 'exercice/result.php?' . api_get_cidreq() . '&amp;id=' . $attempt_result['exe_id'] . '&amp;id_session=' . api_get_session_id() . '&amp;height=500&amp;width=950' . $url_suffix;
        $attempt_link = Display::url(get_lang('Show'), $attempt_url, array('class' => $btn_class . 'btn'));
        $teacher_revised = Display::label(get_lang('Validated'), 'success');
        //$attempt_link = get_lang('NoResult');
        //$attempt_link = Display::return_icon('quiz_na.png', get_lang('NoResult'), array(), ICON_SIZE_SMALL);
        if ($attempt_result['attempt_revised'] == 0) {
            $teacher_revised = Display::label(get_lang('NotValidated'), 'info');
        }
        $row = array('count' => $i, 'date' => api_convert_and_format_date($attempt_result['start_date'], DATE_TIME_FORMAT_LONG));
        $attempt_link .= "&nbsp;&nbsp;&nbsp;" . $teacher_revised;
        if (in_array($objExercise->results_disabled, array(RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS, RESULT_DISABLE_SHOW_SCORE_ONLY, RESULT_DISABLE_SHOW_FINAL_SCORE_ONLY_WITH_CATEGORIES))) {
            $row['result'] = $score;
        }
        if (in_array($objExercise->results_disabled, array(RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS, RESULT_DISABLE_SHOW_FINAL_SCORE_ONLY_WITH_CATEGORIES)) || $objExercise->results_disabled == RESULT_DISABLE_SHOW_SCORE_ONLY && $objExercise->feedback_type == EXERCISE_FEEDBACK_TYPE_END) {
            $row['attempt_link'] = $attempt_link;
        }
        $my_attempt_array[] = $row;
        $i--;
    }
    $table = new HTML_Table(array('class' => 'data_table'));
    //Hiding score and answer
    switch ($objExercise->results_disabled) {
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:overview.php

示例12: getPostStatus

function getPostStatus($current_forum, $row)
{
    $statusIcon = '';
    if ($current_forum['moderated']) {
        $statusIcon = '<br /><br />';
        $row['status'] = empty($row['status']) ? 2 : $row['status'];
        switch ($row['status']) {
            case 1:
                $statusIcon .= Display::label(get_lang('Validated'), 'success');
                break;
            case 2:
                $statusIcon .= Display::label(get_lang('WaitingModeration'), 'warning');
                break;
            case 3:
                $statusIcon .= Display::label(get_lang('Rejected'), 'danger');
                break;
        }
    }
    return $statusIcon;
}
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:20,代码来源:forumfunction.inc.php

示例13: get_work_user_list


//.........这里部分代码省略.........
            // Get the author ID for that document from the item_property table
            $is_author  = false;
            $can_read   = false;

            $owner_id = $work['user_id'];

            /* Because a bug found when saving items using the api_item_property_update()
               the field $item_property_data['insert_user_id'] is not reliable. */

            if (!$is_allowed_to_edit && $owner_id == api_get_user_id()) {
                $is_author = true;
            }

            if ($course_info['show_score'] == 0) {
                $can_read = true;
            }

            if ($work['accepted'] == '0') {
                $class = 'invisible';
            } else {
                $class = '';
            }

            $qualification_exists = false;
            if (!empty($work_data['qualification']) &&
                intval($work_data['qualification']) > 0
            ) {
                $qualification_exists = true;
            }

            $qualification_string = '';
            if ($qualification_exists) {
                if ($work['qualification'] == '') {
                    $qualification_string = Display::label('-');
                } else {
                    $label = 'info';
                    $relativeScore = $work['qualification']/$work_data['qualification'];
                    if ($relativeScore < 0.5) {
                        $label = 'important';
                    } elseif ($relativeScore < 0.75) {
                        $label = 'warning';
                    }
                    $qualification_string = Display::label(
                        $work['qualification'].' / '.$work_data['qualification'],
                        $label
                    );
                }
            }

            $work['qualification_score'] = $work['qualification'];

            $add_string = '';
            $time_expires = api_strtotime($work_assignment['expires_on'], 'UTC');

            if (!empty($work_assignment['expires_on']) &&
                $work_assignment['expires_on'] != '0000-00-00 00:00:00' &&
                $time_expires && ($time_expires < api_strtotime($work['sent_date'], 'UTC'))) {
                $add_string = Display::label(get_lang('Expired'), 'important');
            }

            if (($can_read && $work['accepted'] == '1') ||
                ($is_author && in_array($work['accepted'], array('1', '0'))) ||
                ($is_allowed_to_edit || api_is_drh())
            ) {
                // Firstname, lastname, username
                $work['firstname'] = Display::div($work['firstname'], array('class' => $class));
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:67,代码来源:work.lib.php

示例14: get_user_list_from_course_code


//.........这里部分代码省略.........
         $sql .= " AND (access_url_id =  {$current_access_url_id} ) ";
     }
     if ($return_count && $resumed_report) {
         $sql .= ' AND field_id IS NOT NULL  GROUP BY field_value ';
     }
     $sql .= ' ' . $order_by . ' ' . $limit;
     $rs = Database::query($sql);
     $users = array();
     if ($add_reports) {
         $extra_fields = UserManager::get_extra_fields(0, 100, null, null, true, true);
     }
     $counter = 1;
     $count_rows = Database::num_rows($rs);
     if ($return_count && $resumed_report) {
         return $count_rows;
     }
     $table_user_field_value = Database::get_main_table(TABLE_MAIN_USER_FIELD_VALUES);
     if ($count_rows) {
         while ($user = Database::fetch_array($rs)) {
             $report_info = array();
             if ($return_count) {
                 return $user['count'];
             }
             $user_info = $user;
             $user_info['status'] = $user['status'];
             if (isset($user['role'])) {
                 $user_info['role'] = $user['role'];
             }
             if (isset($user['tutor_id'])) {
                 $user_info['tutor_id'] = $user['tutor_id'];
             }
             if (!empty($session_id)) {
                 $user_info['status_session'] = $user['status_session'];
             }
             $user_info['complete_name'] = api_get_person_name($user_info['firstname'], $user_info['lastname']);
             if ($add_reports) {
                 $course_code = $user['code'];
                 if ($resumed_report) {
                     foreach ($extra_fields as $extra) {
                         if ($extra['1'] == $extra_field) {
                             $user_data = UserManager::get_extra_user_data_by_field($user['user_id'], $extra['1']);
                             break;
                         }
                     }
                     if (empty($user_data[$extra['1']])) {
                         $row_key = '-1';
                         $name = '-';
                     } else {
                         $row_key = $user_data[$extra['1']];
                         $name = $user_data[$extra['1']];
                     }
                     $users[$row_key]['extra_' . $extra['1']] = $name;
                     $users[$row_key]['training_hours'] += Tracking::get_time_spent_on_the_course($user['user_id'], $courseId, 0);
                     $users[$row_key]['count_users'] += $counter;
                     $registered_users_with_extra_field = 0;
                     if (!empty($name) && $name != '-') {
                         $name = Database::escape_string($name);
                         $sql = "SELECT count(user_id) as count FROM {$table_user_field_value} WHERE field_value = '{$name}'";
                         $result_count = Database::query($sql);
                         if (Database::num_rows($result_count)) {
                             $row_count = Database::fetch_array($result_count);
                             $registered_users_with_extra_field = $row_count['count'];
                         }
                     }
                     $users[$row_key]['count_users_registered'] = $registered_users_with_extra_field;
                     $users[$row_key]['average_hours_per_user'] = $users[$row_key]['training_hours'] / $users[$row_key]['count_users'];
                     $category = Category::load(null, null, $course_code);
                     if (!isset($users[$row_key]['count_certificates'])) {
                         $users[$row_key]['count_certificates'] = 0;
                     }
                     if (isset($category[0]) && $category[0]->is_certificate_available($user['user_id'])) {
                         $users[$row_key]['count_certificates']++;
                     }
                 } else {
                     $report_info['course'] = $user['title'];
                     $report_info['user'] = api_get_person_name($user['firstname'], $user['lastname']);
                     $report_info['time'] = api_time_to_hms(Tracking::get_time_spent_on_the_course($user['user_id'], $courseId, 0));
                     $category = Category::load(null, null, $course_code);
                     $report_info['certificate'] = Display::label(get_lang('No'));
                     if (isset($category[0]) && $category[0]->is_certificate_available($user['user_id'])) {
                         $report_info['certificate'] = Display::label(get_lang('Yes'), 'success');
                     }
                     //$report_info['score'] = Tracking::get_avg_student_score($user['user_id'], $courseId, array(), 0);
                     $progress = intval(Tracking::get_avg_student_progress($user['user_id'], $courseId, array(), 0));
                     $report_info['progress_100'] = $progress == 100 ? Display::label(get_lang('Yes'), 'success') : Display::label(get_lang('No'));
                     $report_info['progress'] = $progress . "%";
                     foreach ($extra_fields as $extra) {
                         $user_data = UserManager::get_extra_user_data_by_field($user['user_id'], $extra['1']);
                         $report_info[$extra['1']] = $user_data[$extra['1']];
                     }
                     $users[] = $report_info;
                 }
             } else {
                 $users[$user['user_id']] = $user_info;
             }
         }
         $counter++;
     }
     return $users;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:101,代码来源:course.lib.php

示例15: display_already_registered_label

/**
 * Display the already registerd text in a course in the course catalog
 * @param $in_status
 */
function display_already_registered_label($in_status)
{
    $icon = Display::return_icon('teachers.gif', get_lang('Teacher'));
    if ($in_status == 'student') {
        $icon = Display::return_icon('students.gif', get_lang('Student'));
    }
    echo Display::label($icon.' '.get_lang("AlreadyRegisteredToCourse"), "info");
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:12,代码来源:courses_categories.php


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