public static function useDefault($search_data = null, &$errors, $defaults = null) { $search = new InjectorSearch($defaults); $search->addSearchField('name', 'name', 'contains', '', 'basic'); // Search by Product $search->addSearchField('class_name', 'Class Name', 'contains', '', 'basic'); // Search by Retailer $search->addSearchField('category', 'Category', 'select', '', 'basic'); $injector = new InjectorClass(); $options = array_merge(array('' => 'All'), $injector->getEnumOptions('category')); $search->setOptions('category', $options); $search->setSearchData($search_data, $errors); return $search; }
public static function unserialize($serialized_value) { $classes = array(); $values = unserialize($serialized_value); if (!is_array($values)) { $values = array($values); } foreach ($values as $key) { $injector = new InjectorClass(); $injector->load($key); if ($injector) { $classes[$key] = $injector; } } return $classes; }
public function printdocumentation() { $flash = Flash::Instance(); if (isset($this->_data['cancel'])) { $flash->addMessage('Print Works Order Documentation Cancelled'); sendBack(); } $errors = array(); if (!$this->loadData()) { $this->dataError(); sendBack(); } $worksorder = $this->_uses[$this->modeltype]; $data = $this->_data; $docs_count = unserialize($worksorder->documentation); $merge_file_name = 'mfworksorders_documentation_' . $data['id'] . '_' . date('H_i_s_d_m_Y') . '.pdf'; // Need to check to see if array count is equal to, or less than 1, and if array element 0 is null if (count($docs_count) <= 1 && $docs_count[0] == '') { $errors[] = 'No Documents Assigned to Works Order'; } else { if ($worksorder) { $documents = InjectorClass::unserialize($worksorder->documentation); foreach ($documents as $document) { // when we fire the construct, pass the printController as the report does // not extend another model $model = new $document->class_name($this); $args = array('model' => $worksorder, 'data' => $data, 'merge_file_name' => $merge_file_name); //$response=$model->buildReport($worksorder,$data); $response = $model->buildReport($args); if ($response->status !== true) { $errors[] = $document->class_name . ": " . $response->message; } } } else { $errors[] = 'Failed to find Works Order'; } } if (count($errors) > 0) { $flash->addErrors($errors); } else { // construct file path, print the file and add a success message $merge_file_path = $this->get_filetype_path('tmp') . $merge_file_name; $this->output_file_to_printer($merge_file_path, $data['printer']); $flash->addMessage('Print Works Order Completed'); } sendBack(); }
function getDocumentList() { return InjectorClass::unserialize($this->documentation); }