示例#1
0
 function action_replace($input)
 {
     $trackerId = $input->trackerId->int();
     $confirm = $input->confirm->int();
     $perms = Perms::get('tracker', $trackerId);
     if (!$perms->admin_trackers) {
         throw new Services_Exception_Denied(tr('Reserved to tracker administrators'));
     }
     if ($trackerId) {
         $definition = Tracker_Definition::get($trackerId);
         if (!$definition) {
             throw new Services_Exception_NotFound();
         }
     } else {
         $definition = Tracker_Definition::getDefault();
     }
     $cat_type = 'tracker';
     $cat_objid = $trackerId;
     if ($confirm) {
         $name = $input->name->text();
         if (!$name) {
             throw new Services_Exception_MissingValue('name');
         }
         $data = array('name' => $name, 'description' => $input->description->text(), 'descriptionIsParsed' => $input->descriptionIsParsed->int() ? 'y' : 'n', 'showStatus' => $input->showStatus->int() ? 'y' : 'n', 'showStatusAdminOnly' => $input->showStatusAdminOnly->int() ? 'y' : 'n', 'showCreated' => $input->showCreated->int() ? 'y' : 'n', 'showCreatedView' => $input->showCreatedView->int() ? 'y' : 'n', 'showCreatedBy' => $input->showCreatedBy->int() ? 'y' : 'n', 'showCreatedFormat' => $input->showCreatedFormat->text(), 'showLastModif' => $input->showLastModif->int() ? 'y' : 'n', 'showLastModifView' => $input->showLastModifView->int() ? 'y' : 'n', 'showLastModifBy' => $input->showLastModifBy->int() ? 'y' : 'n', 'showLastModifFormat' => $input->showLastModifFormat->text(), 'defaultOrderKey' => $input->defaultOrderKey->int(), 'defaultOrderDir' => $input->defaultOrderDir->word(), 'doNotShowEmptyField' => $input->doNotShowEmptyField->int() ? 'y' : 'n', 'showPopup' => $input->showPopup->text(), 'defaultStatus' => implode('', (array) $input->defaultStatus->word()), 'newItemStatus' => $input->newItemStatus->word(), 'modItemStatus' => $input->modItemStatus->word(), 'outboundEmail' => $input->outboundEmail->email(), 'simpleEmail' => $input->simpleEmail->int() ? 'y' : 'n', 'userCanSeeOwn' => $input->userCanSeeOwn->int() ? 'y' : 'n', 'writerCanModify' => $input->writerCanModify->int() ? 'y' : 'n', 'writerCanRemove' => $input->writerCanRemove->int() ? 'y' : 'n', 'userCanTakeOwnership' => $input->userCanTakeOwnership->int() ? 'y' : 'n', 'oneUserItem' => $input->oneUserItem->int() ? 'y' : 'n', 'writerGroupCanModify' => $input->writerGroupCanModify->int() ? 'y' : 'n', 'writerGroupCanRemove' => $input->writerGroupCanRemove->int() ? 'y' : 'n', 'useRatings' => $input->useRatings->int() ? 'y' : 'n', 'showRatings' => $input->showRatings->int() ? 'y' : 'n', 'ratingOptions' => $input->ratingOptions->text(), 'useComments' => $input->useComments->int() ? 'y' : 'n', 'showComments' => $input->showComments->int() ? 'y' : 'n', 'showLastComment' => $input->showLastComment->int() ? 'y' : 'n', 'useAttachments' => $input->useAttachments->int() ? 'y' : 'n', 'showAttachments' => $input->showAttachments->int() ? 'y' : 'n', 'orderAttachments' => implode(',', $input->orderAttachments->word()), 'start' => $input->start->int() ? $this->readDate($input, 'start') : 0, 'end' => $input->end->int() ? $this->readDate($input, 'end') : 0, 'autoCreateGroup' => $input->autoCreateGroup->int() ? 'y' : 'n', 'autoCreateGroupInc' => $input->autoCreateGroupInc->groupname(), 'autoAssignCreatorGroup' => $input->autoAssignCreatorGroup->int() ? 'y' : 'n', 'autoAssignCreatorGroupDefault' => $input->autoAssignCreatorGroupDefault->int() ? 'y' : 'n', 'autoAssignGroupItem' => $input->autoAssignGroupItem->int() ? 'y' : 'n', 'autoCopyGroup' => $input->autoCopyGroup->int() ? 'y' : 'n', 'viewItemPretty' => $input->viewItemPretty->text(), 'editItemPretty' => $input->editItemPretty->text(), 'autoCreateCategories' => $input->autoCreateCategories->int() ? 'y' : 'n', 'publishRSS' => $input->publishRSS->int() ? 'y' : 'n', 'sectionFormat' => $input->sectionFormat->word(), 'adminOnlyViewEditItem' => $input->adminOnlyViewEditItem->int() ? 'y' : 'n', 'logo' => $input->logo->text(), 'useFormClasses' => $input->useFormClasses->int() ? 'y' : 'n', 'formClasses' => $input->formClasses->text());
         $trackerId = $this->utilities->updateTracker($trackerId, $data);
         $cat_desc = $data['description'];
         $cat_name = $data['name'];
         $cat_href = "tiki-view_tracker.php?trackerId=" . $trackerId;
         $cat_objid = $trackerId;
         include "categorize.php";
         $groupforAlert = $input->groupforAlert->groupname();
         if ($groupforAlert) {
             $groupalertlib = TikiLib::lib('groupalert');
             $showeachuser = $input->showeachuser->int() ? 'y' : 'n';
             $groupalertlib->AddGroup('tracker', $trackerId, $groupforAlert, $showeachuser);
         }
         $definition = Tracker_Definition::get($trackerId);
     }
     include_once "categorize_list.php";
     $trklib = TikiLib::lib('trk');
     $groupalertlib = TikiLib::lib('groupalert');
     $groupforAlert = $groupalertlib->GetGroup('tracker', 'trackerId');
     return array('title' => $trackerId ? tr('Edit %0', $definition->getConfiguration('name')) : tr('Create Tracker'), 'trackerId' => $trackerId, 'info' => $definition->getInformation(), 'statusTypes' => TikiLib::lib('trk')->status_types(), 'statusList' => preg_split('//', $definition->getConfiguration('defaultStatus', 'o'), -1, PREG_SPLIT_NO_EMPTY), 'sortFields' => $this->getSortFields($definition), 'attachmentAttributes' => $this->getAttachmentAttributes($definition->getConfiguration('orderAttachments', 'created,filesize,hits')), 'startDate' => $this->format($definition->getConfiguration('start'), '%Y-%m-%d'), 'startTime' => $this->format($definition->getConfiguration('start'), '%H:%M'), 'endDate' => $this->format($definition->getConfiguration('end'), '%Y-%m-%d'), 'endTime' => $this->format($definition->getConfiguration('end'), '%H:%M'), 'groupList' => $this->getGroupList(), 'groupforAlert' => $groupforAlert, 'showeachuser' => $groupalertlib->GetShowEachUser('tracker', 'trackerId', $groupforAlert), 'sectionFormats' => $trklib->getGlobalSectionFormats());
 }