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


PHP GradebookUtils::get_users_in_course方法代码示例

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


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

示例1: build_result_add_form

    /**
     * Builds a result form containing inputs for all students with a given course_code
     */
    protected function build_result_add_form()
    {
        $renderer =& $this->defaultRenderer();
        $renderer->setFormTemplate('<form{attributes}>
		      <table class="data_table">
              {content}
		      </table>
		   </form>');
        $tblusers = GradebookUtils::get_users_in_course($this->evaluation_object->get_course_code());
        $nr_users = 0;
        //extra field for check on maxvalue
        $this->addElement('hidden', 'maxvalue', $this->evaluation_object->get_max());
        $this->addElement('hidden', 'minvalue', 0);
        $this->addElement('header', get_lang('AddResult'));
        if (api_is_western_name_order()) {
            $renderer->setHeaderTemplate('<tr>
                   <th>' . get_lang('OfficialCode') . '</th>
                  <th>' . get_lang('UserName') . '</th>
                  <th>' . get_lang('FirstName') . '</th>
                  <th>' . get_lang('LastName') . '</th>
                  <th>' . get_lang('Qualify') . '</th>
               </tr>');
        } else {
            $renderer->setHeaderTemplate('<tr>
                   <th>' . get_lang('OfficialCode') . '</th>
                  <th>' . get_lang('UserName') . '</th>
                  <th>' . get_lang('LastName') . '</th>
                  <th>' . get_lang('FirstName') . '</th>
                  <th>' . get_lang('Qualify') . '</th>
               </tr>');
        }
        $firstUser = true;
        foreach ($tblusers as $user) {
            $element_name = 'score[' . $user[0] . ']';
            $scoreColumnProperties = array('maxlength' => 5);
            if ($firstUser) {
                $scoreColumnProperties['autofocus'] = '';
                $firstUser = false;
            }
            //user_id, user.username, lastname, firstname
            $this->addText($element_name, $this->build_stud_label($user[0], $user[1], $user[2], $user[3]), false, $scoreColumnProperties);
            $this->addRule($element_name, get_lang('OnlyNumbers'), 'numeric');
            $this->addRule(array($element_name, 'maxvalue'), get_lang('OverMax'), 'compare', '<=');
            $this->addRule(array($element_name, 'minvalue'), get_lang('UnderMin'), 'compare', '>=');
            if (api_is_western_name_order()) {
                $user_info = '<td align="left" >' . $user[3] . '</td>';
                $user_info .= '<td align="left" >' . $user[2] . '</td>';
            } else {
                $user_info = '<td align="left" >' . $user[2] . '</td>';
                $user_info .= '<td align="left" >' . $user[3] . '</td>';
            }
            $nr_users++;
            $template = '<tr>
		      <td align="left" >' . $user[4] . '</td>
		      <td align="left" >' . $user[1] . '</td>
		      ' . $user_info . '
		       <td align="left">{element} / ' . $this->evaluation_object->get_max() . '
		         <!-- BEGIN error --><br /><span style="color: #ff0000;font-size:10px">{error}</span><!-- END error -->
		      </td>
            </tr>';
            $renderer->setElementTemplate($template, $element_name);
        }
        $this->addElement('hidden', 'nr_users', $nr_users);
        $this->addElement('hidden', 'evaluation_id', $this->result_object->get_evaluation_id());
        $this->addButtonSave(get_lang('AddResult'), 'submit');
        $template_submit = '<tr>
                <td colspan="4" ></td>
                <td >
                {element}
                    <!-- BEGIN error --><br /><span style="color: #ff0000;font-size:10px">{error}</span><!-- END error -->
                </td>
            </tr>';
        $renderer->setElementTemplate($template_submit, 'submit');
    }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:77,代码来源:evalform.class.php

示例2: get_all_users

 /**
  * @param array $evals
  * @param array $links
  * @return array
  */
 public static function get_all_users($evals = array(), $links = array())
 {
     $coursecodes = array();
     $users = array();
     // By default add all user in course
     $coursecodes[api_get_course_id()] = '1';
     $users = GradebookUtils::get_users_in_course(api_get_course_id());
     foreach ($evals as $eval) {
         $coursecode = $eval->get_course_code();
         // evaluation in course
         if (isset($coursecode) && !empty($coursecode)) {
             if (!array_key_exists($coursecode, $coursecodes)) {
                 $coursecodes[$coursecode] = '1';
                 $users = array_merge($users, GradebookUtils::get_users_in_course($coursecode));
             }
         } else {
             // course independent evaluation
             $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
             $tbl_res = Database::get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
             $sql = 'SELECT user.user_id, lastname, firstname, user.official_code
                     FROM ' . $tbl_res . ' as res, ' . $tbl_user . ' as user
                     WHERE
                         res.evaluation_id = ' . intval($eval->get_id()) . ' AND
                         res.user_id = user.user_id
                     ';
             $sql .= ' ORDER BY lastname, firstname';
             if (api_is_western_name_order()) {
                 $sql .= ' ORDER BY firstname, lastname';
             }
             $result = Database::query($sql);
             $users = array_merge($users, GradebookUtils::get_user_array_from_sql_result($result));
         }
     }
     foreach ($links as $link) {
         // links are always in a course
         $coursecode = $link->get_course_code();
         if (!array_key_exists($coursecode, $coursecodes)) {
             $coursecodes[$coursecode] = '1';
             $users = array_merge($users, GradebookUtils::get_users_in_course($coursecode));
         }
     }
     return $users;
 }
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:48,代码来源:GradebookUtils.php


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