コード例 #1
0
ファイル: Controller.php プロジェクト: rjsmelo/tiki
 function action_duplicate($input)
 {
     $confirm = $input->confirm->int();
     if ($confirm) {
         $trackerId = $input->trackerId->int();
         $perms = Perms::get('tracker', $trackerId);
         if (!$perms->admin_trackers || !Perms::get()->admin_trackers) {
             throw new Services_Exception_Denied(tr('Reserved for tracker administrators'));
         }
         $definition = Tracker_Definition::get($trackerId);
         if (!$definition) {
             throw new Services_Exception_NotFound();
         }
         $name = $input->name->text();
         if (!$name) {
             throw new Services_Exception_MissingValue('name');
         }
         $newId = $this->utilities->duplicateTracker($trackerId, $name, $input->dupCateg->int(), $input->dupPerms->int());
         return array('trackerId' => $newId, 'name' => $name);
     } else {
         $trackers = $this->action_list_trackers($input);
         return array('title' => tr('Duplicate Tracker'), 'trackers' => $trackers["data"]);
     }
 }