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


PHP ExtraField::getRules方法代码示例

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


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

示例1: getQuestionColumns

 /**
  * Get question columns needed for the new question pool page
  * @param int course code
  * @return array
  */
 public static function getQuestionColumns($courseCode = null, $extraFields = array(), $questionFields = array(), $checkFields = false)
 {
     // The order is important you need to check the the $column variable in the model.ajax.php file
     $columns = array('id', get_lang('Name'));
     // Column config.
     $columnModel = array(array('name' => 'iid', 'index' => 'iid', 'width' => '20', 'align' => 'left'), array('name' => 'question', 'index' => 'question', 'width' => '200', 'align' => 'left'));
     // Extra field rules.
     $extraField = new \ExtraField('question');
     $rules = $extraField->getRules($columns, $columnModel, $extraFields, $checkFields);
     // Exercise rules.
     self::getRules($courseCode, $rules, $columns, $columnModel, $questionFields, $checkFields);
     // Adding actions.
     $columns[] = get_lang('Actions');
     $columnModel[] = array('name' => 'actions', 'index' => 'actions', 'width' => '30');
     foreach ($columnModel as $col) {
         $simple_column_name[] = $col['name'];
     }
     $return_array = array('columns' => $columns, 'column_model' => $columnModel, 'rules' => $rules, 'simple_column_name' => $simple_column_name);
     return $return_array;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:25,代码来源:question.class.php

示例2: getGridColumns

 /**
  * @param string $list_type
  * @return array
  */
 public static function getGridColumns($list_type = 'simple')
 {
     // Column config
     $operators = array('cn', 'nc');
     $date_operators = array('gt', 'ge', 'lt', 'le');
     switch ($list_type) {
         case 'simple':
             $columns = array(get_lang('Name'), get_lang('Category'), get_lang('SessionDisplayStartDate'), get_lang('SessionDisplayEndDate'), get_lang('Visibility'));
             $column_model = array(array('name' => 'name', 'index' => 's.name', 'width' => '160', 'align' => 'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)), array('name' => 'category_name', 'index' => 'category_name', 'width' => '40', 'align' => 'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)), array('name' => 'display_start_date', 'index' => 'display_start_date', 'width' => '50', 'align' => 'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)), array('name' => 'display_end_date', 'index' => 'display_end_date', 'width' => '50', 'align' => 'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_one_month', 'sopt' => $date_operators)), array('name' => 'visibility', 'index' => 'visibility', 'width' => '40', 'align' => 'left', 'search' => 'false'));
             break;
         case 'complete':
             $columns = array(get_lang('Name'), get_lang('SessionDisplayStartDate'), get_lang('SessionDisplayEndDate'), get_lang('Coach'), get_lang('Status'), get_lang('Visibility'), get_lang('CourseTitle'));
             $column_model = array(array('name' => 'name', 'index' => 's.name', 'width' => '200', 'align' => 'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)), array('name' => 'display_start_date', 'index' => 'display_start_date', 'width' => '70', 'align' => 'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)), array('name' => 'display_end_date', 'index' => 'display_end_date', 'width' => '70', 'align' => 'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_one_month', 'sopt' => $date_operators)), array('name' => 'coach_name', 'index' => 'coach_name', 'width' => '70', 'align' => 'left', 'search' => 'false', 'searchoptions' => array('sopt' => $operators)), array('name' => 'session_active', 'index' => 'session_active', 'width' => '25', 'align' => 'left', 'search' => 'true', 'stype' => 'select', 'searchoptions' => array('defaultValue' => '1', 'value' => '1:' . get_lang('Active') . ';0:' . get_lang('Inactive')), 'editoptions' => array('value' => '" ":' . get_lang('All') . ';1:' . get_lang('Active') . ';0:' . get_lang('Inactive'))), array('name' => 'visibility', 'index' => 'visibility', 'width' => '40', 'align' => 'left', 'search' => 'false'), array('name' => 'course_title', 'index' => 'course_title', 'width' => '50', 'hidden' => 'true', 'search' => 'true', 'searchoptions' => array('searchhidden' => 'true', 'sopt' => $operators)));
             break;
     }
     // Inject extra session fields
     $session_field = new ExtraField('session');
     $rules = $session_field->getRules($columns, $column_model);
     $column_model[] = array('name' => 'actions', 'index' => 'actions', 'width' => '80', 'align' => 'left', 'formatter' => 'action_formatter', 'sortable' => 'false', 'search' => 'false');
     $columns[] = get_lang('Actions');
     foreach ($column_model as $col_model) {
         $simple_column_name[] = $col_model['name'];
     }
     $return_array = array('columns' => $columns, 'column_model' => $column_model, 'rules' => $rules, 'simple_column_name' => $simple_column_name);
     return $return_array;
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:30,代码来源:sessionmanager.lib.php


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