예제 #1
0
 function action_select($input)
 {
     $permName = $input->permName->word();
     $trackerId = $input->trackerId->int();
     $tracker = \Tracker_Definition::get($trackerId);
     if (!$tracker) {
         throw new Services_Exception_NotFound();
     }
     Services_Exception_Denied::checkObject('tiki_p_view_trackers', 'tracker', $trackerId);
     $schema = new \Tracker\Tabular\Schema($tracker);
     $local = $schema->getFieldSchema($permName);
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $column = $schema->addColumn($permName, $input->mode->text());
         $return = ['field' => $column->getField(), 'mode' => $column->getMode(), 'label' => $column->getLabel(), 'isReadOnly' => $column->isReadOnly(), 'isPrimary' => $column->isPrimaryKey()];
         if ($input->offsetExists('columnIndex')) {
             $return['columnIndex'] = $input->columnIndex->int();
         }
         return $return;
     }
     $return = ['title' => tr('Fields in %0', $tracker->getConfiguration('name')), 'trackerId' => $trackerId, 'permName' => $permName, 'schema' => $local];
     if ($input->offsetExists('columnIndex')) {
         $return['columnIndex'] = $input->columnIndex->int();
     }
     if ($input->offsetExists('mode')) {
         $return['mode'] = $input->mode->text();
     }
     return $return;
 }