public function executeNew(sfWebRequest $request) { if ($request->hasParameter('projects_id')) { $this->forward404Unless($projects = Doctrine_Core::getTable('Projects')->createQuery()->addWhere('id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object projects does not exist (%s).', $request->getParameter('projects_id'))); $this->checkProjectsAccess($projects); $this->checkDiscussionsAccess('insert', false, $projects); $this->form = new DiscussionsForm(null, array('projects' => $projects, 'sf_user' => $this->getUser())); } else { $this->checkDiscussionsAccess('insert'); } $this->choices = app::getProjectChoicesByUser($this->getUser(), true, 'discussions', true); if (count($this->choices) == 2) { unset($this->choices['']); } }
<table> <tr> <?php echo app::getReportFormFilterByTable('Status', 'projects_reports[projects_status_id]', 'ProjectsStatus', $form['projects_status_id']->getValue()); ?> <?php echo app::getReportFormFilterByTable('Type', 'projects_reports[projects_type_id]', 'ProjectsTypes', $form['projects_type_id']->getValue()); ?> </tr> </table> </td> <?php if (count($choices = app::getProjectChoicesByUser($sf_user, true)) > 0) { if (!is_string($v = $form['projects_id']->getValue())) { $v = ''; } echo '<td style="padding-right: 10px;"><b>' . __('Projects') . '</b><br>' . select_tag('projects_reports[projects_id]', explode(',', $v), array('choices' => $choices, 'multiple' => true), array('style' => 'height: 400px; width: 250px;')) . '</td>'; } if (count($choices = app::getItemsChoicesByTable('Users', true)) > 0 and (Users::hasAccess('insert', 'projects', $sf_user) or Users::hasAccess('edit', 'projects', $sf_user))) { if (!is_string($v = $form['in_team']->getValue())) { $v = ''; } echo '<td style="padding-right: 10px;"><b>' . __('In Team') . '</b><br>' . select_tag('projects_reports[in_team]', explode(',', $v), array('choices' => $choices), array('style' => 'width: 250px;')) . '</td>'; } ?> </tr> </table>
<td> <table> <tr> <?php echo app::getReportFormFilterByTable('Status', 'projects_reports[projects_status_id]', 'ProjectsStatus', $form['projects_status_id']->getValue()); ?> <?php echo app::getReportFormFilterByTable('Type', 'projects_reports[projects_type_id]', 'ProjectsTypes', $form['projects_type_id']->getValue()); ?> </tr> </table> </td> <?php if (count($choices = app::getProjectChoicesByUser($sf_user, true, 'discussions')) > 0) { if (!is_string($v = $form['projects_id']->getValue())) { $v = ''; } echo '<td style="padding-right: 10px;"><b>' . __('Projects') . '</b><br>' . select_tag('discussions_reports[projects_id]', explode(',', $v), array('choices' => $choices, 'multiple' => true), array('style' => 'height: 400px; width: 250px;')) . '</td>'; } ?> </tr> </table> </div> </div> <br> <input type="submit" value="<?php echo __('Save'); ?>