public function configure() { parent::configure(); $select_widgets = array('status_id', 'category_id', 'project_id', 'component_id', 'milestone_id', 'assigned_to', 'priority_id'); foreach ($select_widgets as $widget) { $this->widgetSchema[$widget]->setOption('add_empty', '-- no change --'); $this->validatorSchema[$widget]->setOption('required', false); $this->setDefault($widget, ''); } unset($this['title']); }
/** * Update a issue * @param $args array * @param $request PKPRequest * @return string Serialized JSON object */ function updateIssue($args, $request) { $issue = $this->getAuthorizedContextObject(ASSOC_TYPE_ISSUE); import('controllers.grid.issues.form.IssueForm'); $issueForm = new IssueForm($issue); $issueForm->readInputData(); if ($issueForm->validate($request)) { $issueId = $issueForm->execute($request); return DAO::getDataChangedEvent($issueId); } else { $json = new JSONMessage(true, $issueForm->fetch($request)); return $json->getString(); } }
/** * Edit the current issue form */ function editIssue($args) { $issueId = isset($args[0]) ? (int) $args[0] : 0; $this->validate($issueId, true); $issue =& $this->issue; $this->setupTemplate(EDITOR_SECTION_ISSUES); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('issueId', $issueId); $journal =& Request::getJournal(); $journalId = $journal->getId(); import('classes.issue.IssueAction'); $templateMgr->assign('issueOptions', IssueAction::getIssueOptions()); import('classes.issue.form.IssueForm'); if (checkPhpVersion('5.0.0')) { // WARNING: This form needs $this in constructor $issueForm = new IssueForm('editor/issues/issueData.tpl'); } else { $issueForm =& new IssueForm('editor/issues/issueData.tpl'); } $issueForm->readInputData(); if ($issueForm->validate($issueId)) { $issueForm->execute($issueId); $issueForm->initData($issueId); //%CBP% add Issue ISBN to table $CBPPlatformDao =& DAORegistry::getDAO('CBPPlatformDAO'); $CBPPlatformDao->setIssueISBN($issueId, Request::getUserVar('isbn')); } $templateMgr->assign_by_ref('issue', $issue); $templateMgr->assign('unpublished', !$issue->getPublished()); $issueForm->display(); }
/** * Edit the current issue form */ function editIssue($args, $request) { $issueId = (int) array_shift($args); $this->validate($issueId, true); $issue =& $this->issue; $this->setupTemplate(EDITOR_SECTION_ISSUES); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('issueId', $issueId); $journal =& $request->getJournal(); $journalId = $journal->getId(); import('classes.issue.IssueAction'); $templateMgr->assign('issueOptions', IssueAction::getIssueOptions()); import('classes.issue.form.IssueForm'); if (checkPhpVersion('5.0.0')) { // WARNING: This form needs $this in constructor $issueForm = new IssueForm('editor/issues/issueData.tpl'); } else { $issueForm =& new IssueForm('editor/issues/issueData.tpl'); } $issueForm->readInputData(); if ($issueForm->validate($issue)) { $issueForm->execute($issueId); $issueForm->initData($issueId); } $templateMgr->assign_by_ref('issue', $issue); $templateMgr->assign('unpublished', !$issue->getPublished()); $issueForm->display(); }
/** * Configures the form fields */ public function configure() { $this->widgetSchema['status_id'] = new sfWidgetFormDoctrineChoice(array('model' => 'Status', 'query' => $this->getQueryForStatusesList())); $this->widgetSchema['priority_id'] = new sfWidgetFormDoctrineChoice(array('model' => 'Priority', 'query' => $this->getQueryForPriorityList())); $this->widgetSchema['starting_date'] = new sfWidgetFormDate(); $this->widgetSchema['ending_date'] = new sfWidgetFormDate(); $this->widgetSchema['project_id'] = new sfWidgetFormInputHidden(); $this->widgetSchema['users_list'] = new sfWidgetFormDoctrineChoiceMany(array('model' => 'Profile', 'query' => $this->getQueryForUsers())); $this->widgetSchema['milestone_id'] = new sfWidgetFormDoctrineSelect(array('model' => 'Milestone', 'add_empty' => true, 'query' => $this->getQueryForMilestones())); $this->widgetSchema['related_issue_list'] = new sfWidgetFormDoctrineChoiceMany(array('model' => 'Issue', 'query' => $this->getQueryForRelatedIssue())); $this->validatorSchema['status_id'] = new sfValidatorDoctrineChoice(array('model' => 'Status', 'column' => 'id', 'required' => true)); $this->validatorSchema['priority_id'] = new sfValidatorDoctrineChoice(array('model' => 'Priority', 'column' => 'id', 'required' => true)); $this->validatorSchema['starting_date'] = new sfValidatorDate(array('required' => false)); $this->validatorSchema['ending_date'] = new sfValidatorDate(array('required' => false)); $this->validatorSchema['project_id'] = new sfValidatorDoctrineChoice(array('model' => 'Project', 'column' => 'id', 'required' => true)); $this->validatorSchema['users_list'] = new sfValidatorDoctrineChoiceMany(array('model' => 'Profile', 'alias' => '', 'query' => $this->getQueryForUsers(), 'required' => false)); $this->validatorSchema['milestone_id'] = new sfValidatorDoctrineChoice(array('model' => 'Milestone', 'alias' => '', 'query' => $this->getQueryForMilestones(), 'required' => false)); $this->validatorSchema['title'] = new sfValidatorString(array('required' => true, 'max_length' => 256), array('required' => 'Title is mandatory')); $this->validatorSchema['related_issue_list'] = new sfValidatorDoctrineChoiceMany(array('model' => 'Issue', 'alias' => '', 'required' => false, 'query' => $this->getQueryForRelatedIssue())); parent::configure(); }