public static function get_session_columns($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('SessionDisplayStartDate'), get_lang('SessionDisplayEndDate'), get_lang('Visibility')); $column_model = array(array('name' => 'name', 'index' => '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' => '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' => '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 SessionField(); $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; }
echo get_lang('ReadOnly'); } elseif ($session['visibility'] == 2) { echo get_lang('Visible'); } elseif ($session['visibility'] == 3) { echo api_ucfirst(get_lang('Invisible')); } } else { //By default course sessions can be access normally see function api_get_session_visibility() when no date_end is proposed echo get_lang('Visible'); } ?> </td> </tr> <?php $session_field = new SessionField(); $session_fields = $session_field->get_all(); foreach ($session_fields as $session_field) { if ($session_field['field_visible'] != '1') { continue; } $obj = new SessionFieldValue(); $result = $obj->get_values_by_handler_and_field_id($id_session, $session_field['id'], true); $session_value = null; if ($result) { $session_value = $result['field_value']; } echo "<tr>"; echo "<td> {$session_field['field_display_text']} </td>"; echo "<td> {$session_value} </td>"; echo "</tr>";
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param SessionField $value A SessionField object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(SessionField $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null self::$instances[$key] = $obj; } }
/** * Exclude object from result * * @param SessionField $sessionField Object to remove from the list of results * * @return SessionFieldQuery The current query, for fluid interface */ public function prune($sessionField = null) { if ($sessionField) { $this->addUsingAlias(SessionFieldPeer::ID, $sessionField->getId(), Criteria::NOT_EQUAL); } return $this; }