public function _new() { parent::_new(); // get the uzlet object $uzlet = $this->_uses[$this->modeltype]; // get uzlet calls $this->view->set('uzlet_calls', $uzlet->getCalls()); // get uzlet modules $this->view->set('selected_uzlet_modules', $uzlet->getModules()); // get all modules $modules = DataObjectFactory::Factory('ModuleObject'); $this->view->set('uzlet_modules', $modules->getAll()); $sidebar = new SidebarController($this->view); $sidebarlist = array(); $sidebarlist['index'] = array('tag' => 'View All Uzlet', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'index')); $sidebarlist['new'] = array('tag' => 'New Uzlet', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'new')); $sidebar->addList('Actions', $sidebarlist); $this->view->register('sidebar', $sidebar); $this->view->set('sidebar', $sidebar); }
public function add_response() { parent::_new(); $ticket = $this->_uses['Ticket']; $ticket->load($this->_data['id']); $ticketResponse = $this->_uses['TicketResponse']; $ticketResponse->ticket_id = $ticket->id; $responses = new TicketResponseCollection(new TicketResponse()); $sh = new SearchHandler($responses, false); $sh->AddConstraint(new Constraint('ticket_id', '=', $ticket->id)); $responses->load($sh); $this->view->set('responses', $responses->getContents()); }
public function _new() { // if (!$this->loadData()) // { // $this->dataError(); // sendBack(); // } parent::_new(); // an array of legacy search fields $search_fields = array(); $flash = Flash::Instance(); // get the report model, lets not envoke it again... that's not cool $report = $this->_uses[$this->modeltype]; if (!empty($this->_data['tablename'])) { $report_options[$this->_data['tablename']] = $this->_data['tablename']; } else { $report_options = $report::getTables(); } if (!$report->isLoaded()) { $report->tablename = current($report_options); $this->view->set('update', false); } else { $this->view->set('update', true); } $this->view->set('report_options', $report_options); // get the fields for the tablename and sort them $available_fields = $this->getColumns($report->tablename); ksort($available_fields); // unserialise the options from the db $options = unserialize($report->options); if ($options !== FALSE) { // overlay the defaults so we've got a full set of options $options = $this->expand_options($options, $report->tablename); // sort options by position $options = $this->sort_options($options); // loop through used fields and remove them from the available fields array foreach ($options as $field => $field_options) { // remove the field from the available fields array unset($available_fields[$field]); // we need to check against legacy search options if ($field_options['field_type'] === 'search') { // build an array of broken search options $search_fields[] = $field; // update the legacy options $options[$field] = array_merge($this->default_options, $options[$field]); // ATTN: boolean values didn't work here... but that's what the defaults are set as // set other specific search settings $options[$field]['field_type'] = 'normal'; $options[$field]['normal_enable_search'] = 'true'; $options[$field]['normal_display_field'] = 'false'; // if a default value exists if (isset($options[$field]['default_value'])) { // set it to the new option name $options[$field]['search_default_value'] = $options[$field]['default_value']; // unset the old version unset($options[$field]['default_value']); } } } unset($available_fields['filter']); } else { $options = array(); } if (!empty($search_fields)) { $flash->addError('Legacy search fields found, click save <strong>immediately</strong> to update'); } $description = $report->description; // set smarty vars $this->view->set('description', $description); $this->view->set('available_fields', $available_fields); $this->view->set('selected_tablename', $report->tablename); $this->view->set('options', $options); $this->view->set('report', $report); //Set report defintion list $report_type_id = ReportType::getReportTypeID('Reports'); $definition_list = ReportDefinition::getReportsByType($report_type_id); array_unshift($definition_list, "Default"); $this->view->set('report_definitions', $definition_list); //Set currently selected report definition $selected_def = ReportDefinition::getDefinitionByID($report->report_definition); if ($selected_def->_data['name'] == 'PrintCollection') { $this->view->set('selected_reportdef', 'Default'); } else { $this->view->set('selected_reportdef', $selected_def->_data['name']); } }
public function _new() { parent::_new(); $current = $this->_uses[$this->modeltype]; $this->view->set('clickaction', 'view'); $s_data = array(); // Set context from calling module if (isset($this->_data['id']) && $current->isLoaded()) { $s_data['parent_id'] = $current->parent_id; } elseif (isset($this->_data['parent_id']) && $this->_data['parent_id'] != '') { $s_data['parent_id'] = $this->_data['parent_id']; } else { $s_data['parent_id'] = '-1'; } $this->setSearch($this->_templateobject, 'selectorSearch', 'itemSearch', $s_data); $collection = new SelectorCollection($this->_templateobject, $this->itemOverviewName); $sh = $this->setSearchHandler($collection); $sh->setFields(array('id', 'name')); $sh->setOrderby('name'); parent::index($collection, $sh); $this->view->set('SelectorObject', $current); $this->view->set('collection', $collection); $this->view->set('options', $collection->getAssoc()); if ($current->isLoaded()) { $parent_id = $current->parent_id; $description = $current->description; } else { $parent_id = $this->search->getValue('parent_id'); if ($parent_id != -1) { $parent = new SelectorObject($this->itemTableName); $parent->load($parent_id); $description = $this->getNextDescription(strtolower($parent->description)); } else { $parent_id = ''; $description = strtolower(current($this->itemFields)); } } $parent = $this->getHierarchy($parent_id, $description); $this->view->set('description', $description); $this->view->set('no_ordering', TRUE); $top_level = current($this->itemFields); $this->setTemplateName('selector_new'); }