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


PHP Question::getQuestionColumns方法代码示例

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


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

示例1: indexAction


//.........这里部分代码省略.........
             $course_id = api_get_course_int_id();
             if ($type == 'registered') {
                 $count = $obj->get_usergroup_by_course_with_data_count($course_id);
             } else {
                 $count = $obj->get_count();
             }
             break;
         default:
             exit;
     }
     //3. Calculating first, end, etc
     $total_pages = 0;
     if ((int) $count > 0) {
         if (!empty($limit)) {
             $total_pages = ceil($count / $limit);
         }
     }
     if ($page > $total_pages) {
         $page = $total_pages;
     }
     $start = $limit * $page - $limit;
     if ($start < 0) {
         $start = 0;
     }
     //4. Deleting an element if the user wants to
     if ($operation == 'del') {
         $obj->delete($request->get('id'));
     }
     $is_allowedToEdit = api_is_allowed_to_edit(null, true) || api_is_allowed_to_edit(true) || api_is_drh();
     //5. Querying the DB for the elements
     $columns = array();
     switch ($action) {
         case 'get_questions':
             $columns = \Question::getQuestionColumns(api_get_course_id(), $extra_fields, $questionFields, true);
             $columns = $columns['simple_column_name'];
             $result = \Question::getQuestions($app, $categoryId, $exerciseId, $courseId, array('where' => $where_condition, 'order' => "{$sidx} {$sord}", 'extra' => $extra_fields, 'question' => $questionFields, 'limit' => "{$start} , {$limit}"));
             //var_dump($result);
             break;
         case 'get_user_list_plugin_widescale':
             $columns = array('username', 'firstname', 'lastname', 'exam_password');
             $column_names = array(get_lang('Username'), get_lang('Firstname'), get_lang('Lastname'), get_lang('Password'));
             $result = \UserManager::get_user_data($start, $limit, $sidx, $sord);
             break;
         case 'get_question_list':
             if (isset($exercise) && !empty($exercise)) {
                 $columns = array('question', 'type', 'category', 'level', 'score', 'actions');
                 $result = $exercise->getQuestionListPagination($start, $limit, $sidx, $sord, $where_condition);
             }
             break;
         case 'get_group_reporting':
             $columns = array('name', 'time', 'progress', 'score', 'works', 'messages', 'actions');
             $result = \Tracking::get_group_reporting($course_id, $group_id, 'all', $start, $limit, $sidx, $sord, $where_condition);
             break;
         case 'get_course_exercise_medias':
             $columns = array('question');
             $result = \Question::get_course_medias($course_id, $start, $limit, $sidx, $sord, $where_condition);
             if (!empty($result)) {
                 foreach ($result as &$media) {
                     $media['id'] = $media['iid'];
                 }
             }
             break;
         case 'get_user_course_report_resumed':
             $columns = array('extra_ruc', 'training_hours', 'count_users', 'count_users_registered', 'average_hours_per_user', 'count_certificates');
             $column_names = array(get_lang('Company'), get_lang('TrainingHoursAccumulated'), get_lang('CountOfSubscriptions'), get_lang('CountOfUsers'), get_lang('AverageHoursPerStudent'), get_lang('CountCertificates'));
             $result = \CourseManager::get_user_list_from_course_code(null, null, "LIMIT {$start}, {$limit}", " {$sidx} {$sord}", null, null, true, true, 'ruc');
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:67,代码来源:ModelAjaxController.php

示例2: getQuestionsByCategoryAction

 /**
  * Gets the question list per category
  * @param Application $app
  * @param $categoryId
  * @return Response
  */
 public function getQuestionsByCategoryAction(Application $app, $categoryId)
 {
     // Getting CQuizCategory repo.
     /** @var \Doctrine\ORM\EntityManager $em */
     $em = $app['orm.em'];
     $repo = $em->getRepository('Entity\\CQuizCategory');
     /** @var \Entity\CQuizCategory $category */
     $category = $repo->find($categoryId);
     $questionColumns = \Question::getQuestionColumns();
     $columnModel = $questionColumns['column_model'];
     $columns = $questionColumns['columns'];
     $rules = $questionColumns['rules'];
     $grid = \Display::grid_html('questions');
     //jqgrid will use this URL to do the selects
     $url = $app['url_generator']->generate('model_ajax') . '?a=get_questions&categoryId=' . $categoryId;
     $extraParams['postData'] = array('filters' => array("groupOp" => "AND", "rules" => $rules));
     // Autowidth.
     $extraParams['autowidth'] = 'true';
     // Height auto.
     $extraParams['height'] = 'auto';
     $token = null;
     $editUrl = $app['url_generator']->generate('admin_questions');
     $actionLinks = 'function action_formatter(cellvalue, options, rowObject) {
         return \'<a href="' . $editUrl . '/\'+rowObject[0]+\'/edit">' . \Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>' . '\';
     }';
     $testCategory = new \Testcategory($categoryId);
     $count = $testCategory->getCategoryQuestionsNumber();
     $js = \Display::grid_js('questions', $url, $columns, $columnModel, $extraParams, array(), $actionLinks, true);
     //$count = $repo->childCount($category);
     $app['template']->assign('category_children', $count);
     $app['template']->assign('category', $category);
     $app['template']->assign('grid', $grid);
     $app['template']->assign('js', $js);
     $response = $app['template']->render_template('admin/questionmanager/questions.tpl');
     return new Response($response, 200, array());
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:42,代码来源:QuestionManagerController.php

示例3: questionPoolAction

 /**
  * @param Application $app
  * @param string $cidReq
  * @param int $exerciseId
  * @return Response
  */
 public function questionPoolAction(Application $app, $cidReq = null, $exerciseId = null)
 {
     $extraJS = array();
     //@todo improve this JS includes should be added using twig
     $extraJS[] = api_get_jqgrid_js();
     $app['extraJS'] = $extraJS;
     // @todo this should be auto
     if (empty($exerciseId)) {
         $breadcrumbs = array(array('name' => get_lang('Exercise'), 'url' => array('uri' => api_get_path(WEB_CODE_PATH) . 'exercice/exercice.php?' . api_get_cidreq())), array('name' => get_lang('QuestionPool'), 'url' => array('route' => 'exercise_question_pool_global', 'routeParameters' => array('cidReq' => api_get_course_id(), 'id_session' => api_get_session_id()))));
     } else {
         $breadcrumbs = array(array('name' => get_lang('Exercise'), 'url' => array('uri' => api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&exerciseId=' . $exerciseId)), array('name' => get_lang('QuestionPool'), 'url' => array('route' => 'exercise_question_pool', 'routeParameters' => array('cidReq' => api_get_course_id(), 'id_session' => api_get_session_id(), 'exerciseId' => $exerciseId))));
     }
     $this->setBreadcrumb($app, $breadcrumbs);
     $questionColumns = \Question::getQuestionColumns($cidReq);
     $columnModel = $questionColumns['column_model'];
     $columns = $questionColumns['columns'];
     $rules = $questionColumns['rules'];
     $grid = \Display::grid_html('questions');
     // jqgrid will use this URL to do the selects
     $extraConditions = null;
     if (!empty($cidReq)) {
         $extraConditions = "courseId=" . api_get_course_int_id();
     }
     if (!empty($exerciseId)) {
         $extraConditions .= "&exerciseId=" . $exerciseId;
     }
     $url = $app['url_generator']->generate('model_ajax') . '?a=get_questions&' . $extraConditions;
     $extraParams['postData'] = array('filters' => array("groupOp" => "AND", "rules" => $rules));
     // Auto-width.
     $extraParams['autowidth'] = 'true';
     // Height auto.
     $extraParams['height'] = 'auto';
     $token = null;
     $js = \Display::grid_js('questions', $url, $columns, $columnModel, $extraParams, array(), null, true);
     $app['template']->assign('grid', $grid);
     $app['template']->assign('js', $js);
     $response = $app['template']->render_template('exercise/question_pool.tpl');
     return new Response($response, 200, array());
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:45,代码来源:ExerciseController.php


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