예제 #1
0
 public function render()
 {
     $res = parent::render();
     if (!function_exists('to_array')) {
         function to_array(&$obj)
         {
             if ($obj instanceof data) {
                 $obj = $obj->to_array();
             }
             if (is_array($obj)) {
                 foreach ($obj as &$el) {
                     to_array($el);
                 }
             }
         }
     }
     if (@$this->markitup) {
         $opt = clone $this->markitup->opt;
         to_array($opt);
         $this->view->messify->append('css', '/' . DIR_KERNEL . '/ctl/markitup/skins/' . $this->markitup->skin . '/style.css')->append('css', $this->markitup->set_style)->append('js', '/' . DIR_KERNEL . '/ctl/markitup/jquery.markitup.js')->append_inline('js', '$("textarea[name=\'' . $this->name . '\']").markItUp(' . Zend\Json\Json::encode($opt, false, array('enableJsonExprFinder' => true)) . ');');
         if ($this->markitup->class) {
             $res = '<div class="' . $this->markitup->class . '">' . $res . '</div>';
         }
     }
     if (@$this->ckeditor) {
         $opt = clone $this->ckeditor->opt;
         to_array($opt);
         $this->view->messify->append('js', '/' . DIR_KERNEL . '/ctl/ckeditor/ckeditor.js')->append('js', '/' . DIR_KERNEL . '/ctl/ckfinder/ckfinder.js')->append_inline('js', 'var editor_' . $this->name . ' = CKEDITOR.replace("' . $this->name . '", ' . Zend\Json\Json::encode($opt, false, array('enableJsonExprFinder' => true)) . ');CKFinder.setupCKEditor(editor_' . $this->name . ', "/' . DIR_KERNEL . '/ctl/ckfinder/");');
         if ($this->ckeditor->class) {
             $res = '<div class="' . $this->ckeditor->class . '">' . $res . '</div>';
         }
     }
     return $res;
 }
 function render_attributes()
 {
     if (!isset($this->attributes['path']) || !$this->attributes['path']) {
         $action_path = $_SERVER['PHP_SELF'];
         if (isset($_REQUEST['node_id'])) {
             $action_path .= '?node_id=' . $_REQUEST['node_id'];
         }
     } else {
         $action_path = $this->attributes['path'];
     }
     if (strpos($action_path, '?') === false) {
         $action_path .= '?';
     } else {
         $action_path .= '&';
     }
     $parent_id = $this->parent->get_server_id();
     if (isset($this->attributes['action'])) {
         $action_path .= 'action=' . $this->attributes['action'];
     }
     if (isset($this->attributes['reload_parent']) && $this->attributes['reload_parent']) {
         $action_path .= '&reload_parent=1';
         unset($this->attributes['reload_parent']);
     }
     $this->attributes['onclick'] .= "submit_form('grid_form_{$parent_id}', '{$action_path}')";
     unset($this->attributes['path']);
     unset($this->attributes['action']);
     parent::render_attributes();
 }
 function render_attributes()
 {
     if (!isset($this->attributes['path']) || !$this->attributes['path']) {
         $action_path = $_SERVER['PHP_SELF'];
         $request = request::instance();
         if ($node_id = $request->get_attribute('node_id')) {
             $action_path .= '?node_id=' . $node_id;
         }
     } else {
         $action_path = $this->attributes['path'];
     }
     if (strpos($action_path, '?') === false) {
         $action_path .= '?';
     } else {
         $action_path .= '&';
     }
     if (isset($this->attributes['action'])) {
         $action_path .= 'action=' . $this->attributes['action'];
     }
     if (isset($this->attributes['reload_parent']) && $this->attributes['reload_parent']) {
         $action_path .= '&reload_parent=1';
         unset($this->attributes['reload_parent']);
     }
     if (!isset($this->attributes['onclick'])) {
         $this->attributes['onclick'] = '';
     }
     $this->attributes['onclick'] .= "submit_form(this.form, '{$action_path}')";
     unset($this->attributes['path']);
     unset($this->attributes['action']);
     parent::render_attributes();
 }
 function render_attributes()
 {
     $this->_process_attributes();
     if (!$this->path) {
         $action_path = $_SERVER['PHP_SELF'];
         $request = request::instance();
         if ($node_id = $request->get_attribute('node_id')) {
             $action_path .= '?node_id=' . $node_id;
         }
     } else {
         $action_path = $this->path;
     }
     if (strpos($action_path, '?') === false) {
         $action_path .= '?';
     } else {
         $action_path .= '&';
     }
     if ($this->action) {
         $action_path .= 'action=' . $this->action;
     }
     if ((bool) $this->reload_parent) {
         $action_path .= '&reload_parent=1';
     }
     $this->attributes['onclick'] = $this->onclick;
     $this->attributes['onclick'] .= "submit_form(this.form, '{$action_path}')";
     parent::render_attributes();
     unset($this->attributes['onclick']);
 }
 public function edit($job_site_attachment_id = null, $job_site_id = null)
 {
     require_capability('building:writejobsites');
     $job_site_attachment_data = new stdClass();
     if (!empty($job_site_attachment_id)) {
         require_capability('building:editjobsites');
         $job_site_attachment_data = $this->job_site_attachment_model->get($job_site_attachment_id);
         $job_site_id = $job_site_attachment_data->job_site_id;
         $job_site_attachment_data->url = base_url() . 'application/modules/building/files/job_site_drawings/' . $job_site_id . '/' . $job_site_attachment_data->hash;
         form_element::$default_data = (array) $job_site_attachment_data;
         if (!empty(form_element::$default_data['attachment'])) {
             form_element::$default_data['attachment'] = $job_site_attachment_data->filename_original;
         }
         // Set up title bar
         $title = "Edit Job site drawing";
         $help = "Use this form to edit the job site's drawing.";
     } else {
         // adding a new job_site
         $title = "Create a new job site drawing";
         $help = 'Use this form to create a new job site drawing.';
     }
     $this->config->set_item('replacer', array('building' => null, 'job_site_attachments' => array('/building/job_site_attachments/index|Job site drawings'), 'edit' => $title, 'add' => $title));
     $title_options = array('title' => $title, 'help' => $help, 'expand' => 'page', 'icons' => array());
     $pageDetails = array('title' => $title, 'title_options' => $title_options, 'content_view' => 'job_site_attachments/edit', 'attachment' => $job_site_attachment_data, 'job_site_attachment_id' => $job_site_attachment_id, 'job_site_id' => $job_site_id, 'feature_type' => 'Custom feature', 'csstoload' => array());
     $this->load->view('template/default', $pageDetails);
 }
 /**
  * Overrides then calls with the parent render_attributes() method. Makes
  * sure there is always a value attribute, even if it's empty.
  * Called from within a compiled template render function.
  *
  * @return void
  * @access protected
  */
 function render_attributes()
 {
     $value = $this->get_value();
     if (!is_null($value)) {
         $this->attributes['value'] = $value;
     }
     parent::render_attributes();
 }
 /**
  * Overrides then calls with the parent render_attributes() method dealing
  * with the special case of the checked attribute
  * 
  * @return void 
  * @access protected 
  */
 function render_attributes()
 {
     $value = $this->get_value();
     if ($value) {
         $this->attributes['checked'] = 1;
     } else {
         unset($this->attributes['checked']);
     }
     parent::render_attributes();
 }
예제 #8
0
 public function edit($assignment_id)
 {
     $assignment = $this->assignment_model->get($assignment_id);
     $unit_data = $this->unit_model->get_values($assignment->unit_id);
     form_element::$default_data = (array) $unit_data;
     $title = "Edit unit";
     $help = 'Use this form to edit this unit';
     $this->config->set_item('replacer', array('orders' => array('/orders/order/index|Jobs'), 'edit' => $title));
     $title_options = array('title' => $title, 'help' => $help, 'expand' => 'page', 'icons' => array());
     $pageDetails = array('title' => $title, 'title_options' => $title_options, 'content_view' => 'orders/unit/edit', 'order_id' => $unit_data['order_id'], 'assignment_id' => $assignment_id, 'unit_data' => $unit_data, 'dropdowns' => $this->get_dropdowns(), 'feature_type' => 'Custom Feature', 'jstoloadinfooter' => array('application/orders/unit_edit'), 'csstoload' => array());
     $this->load->view('template/default', $pageDetails);
 }
예제 #9
0
 function edit($role_id)
 {
     $role_id = (int) $role_id;
     require_capability('users:editroles');
     $role = $this->role_model->get($role_id);
     form_element::$default_data = (array) $role;
     // Set up title bar
     $title = "Edit {$role->name} Role";
     $this->config->set_item('replacer', array('users' => array('/users/role/browse|Roles'), 'edit' => $title));
     $title_options = array('title' => $title, 'help' => 'Use this page to change the name and description of the ' . $role->name . ' role', 'expand' => 'page', 'icons' => array());
     $pageDetails = array('title' => $title, 'title_options' => $title_options, 'parent_ids' => $this->role_model->get_potential_parent_ids($role_id), 'content_view' => 'users/role/edit', 'feature_type' => 'Streamliner Core', 'role_id' => $role_id);
     $this->load->view('template/default', $pageDetails);
 }
예제 #10
0
 function edit($capability_id = null)
 {
     if (empty($capability_id)) {
         require_capability('users:writecapabilities');
         $title = "Add a capability";
         $title_options = array('title' => $title, 'help' => 'Use this page to add a new capability', 'expand' => 'page', 'icons' => array());
     } else {
         require_capability('users:editcapabilities');
         $capability = $this->capability_model->get($capability_id);
         form_element::$default_data = (array) $capability;
         $this->db->where_not_in('id', array($capability_id));
         $title = "Edit {$capability->name} capability";
         $title_options = array('title' => $title, 'help' => 'Use this page to change the name and description of the ' . $capability->name . ' capability', 'expand' => 'page', 'icons' => array());
     }
     $this->config->set_item('replacer', array('users' => array('/users/capability/browse|capabilities'), 'edit' => $title));
     $pageDetails = array('title' => $title, 'title_options' => $title_options, 'content_view' => 'users/capability/edit', 'parent_caps' => $this->capability_model->get_dropdown('name', false, false, false, null, null, 'name'), 'capability_id' => $capability_id, 'feature_type' => 'Streamliner Core');
     $this->load->view('template/default', $pageDetails);
 }
예제 #11
0
파일: select.php 프로젝트: s-kalaus/ekernel
 public function render()
 {
     if ($this->chosen) {
         $opt = array('no_results_text' => $this->view->translate('form_element_select_no_results_text'), 'placeholder_text' => $this->view->translate('form_element_select_placeholder_text'), 'placeholder_text_multiple' => $this->view->translate('form_element_select_placeholder_text_multiple'));
         $this->view->messify->append('js', '/' . DIR_KERNEL . '/ctl/chosen/chosen.jquery.js')->append_inline('js', '$("select[name=\'' . $this->name . ($this->multiple ? '\\[\\]' : '') . '\']").chosen(' . Zend\Json\Json::encode($opt, false, array('enableJsonExprFinder' => true)) . ');');
         if ($this->chosen->css) {
             $this->view->messify->append('css', '/' . DIR_KERNEL . '/ctl/chosen/chosen.css');
         }
     }
     if ($this->uniform) {
         $opt = array();
         $this->view->messify->append('js', '/' . DIR_KERNEL . '/ctl/uniform/jquery.uniform.js')->append_inline('js', '$("select[name=\'' . $this->name . '\']").uniform(' . Zend\Json\Json::encode($opt, false, array('enableJsonExprFinder' => true)) . ');');
         if ($this->chosen->css) {
             $this->view->messify->append('css', '/' . DIR_KERNEL . '/ctl/uniform/themes/default/css/uniform.default.css');
         }
     }
     return parent::render();
 }
예제 #12
0
 public function edit($brand_id = null)
 {
     require_capability('site:writebrands');
     if (!empty($brand_id)) {
         require_capability('site:editbrands');
         $brand_data = (array) $this->brand_model->get($brand_id);
         form_element::$default_data = $brand_data;
         // Set up title bar
         $title = "Edit {$brand_data['name']} brand";
         $help = "Use this form to edit the {$brand_data['name']} brand.";
     } else {
         // adding a new brand
         $title = "Create a new brand";
         $help = 'Use this form to create a new brand.';
     }
     $this->config->set_item('replacer', array('miniant' => array('/home|Administration'), 'brands' => array('/miniant/brands/index|Brands'), 'edit' => $title, 'add' => $title));
     $title_options = array('title' => $title, 'help' => $help, 'expand' => 'page', 'icons' => array());
     $pageDetails = array('title' => $title, 'title_options' => $title_options, 'content_view' => 'brand/edit', 'brand_id' => $brand_id, 'feature_type' => 'Custom feature', 'unit_types' => $this->unit_model->get_types_dropdown('--Select an equipment type--'), 'csstoload' => array());
     $this->load->view('template/default', $pageDetails);
 }
예제 #13
0
 public function edit($job_site_id = null)
 {
     require_capability('building:writejobsites');
     if (!empty($job_site_id)) {
         require_capability('building:editjobsites');
         $job_site_data = (array) $this->job_site_model->get($job_site_id);
         form_element::$default_data = $job_site_data;
         // Set up title bar
         $title = "Edit Job site";
         $help = "Use this form to edit the job site.";
     } else {
         // adding a new job_site
         $title = "Create a new job site";
         $help = 'Use this form to create a new job site.';
     }
     $this->config->set_item('replacer', array('building' => null, 'job_sites' => array('/building/job_sites/index|Job sites'), 'edit' => $title, 'add' => $title));
     $title_options = array('title' => $title, 'help' => $help, 'expand' => 'page', 'icons' => array());
     $pageDetails = array('title' => $title, 'title_options' => $title_options, 'content_view' => 'job_site/edit', 'job_site_id' => $job_site_id, 'feature_type' => 'Custom feature', 'csstoload' => array());
     $this->load->view('template/default', $pageDetails);
 }
예제 #14
0
 public function edit($id = null)
 {
     require_capability('site:writetypes');
     if (!empty($id)) {
         require_capability('site:edittypes');
         $type_data = $this->type_model->get($id);
         form_element::$default_data = (array) $type_data;
         // Set up title bar
         $title = "Edit type";
         $help = "Use this form to edit the type";
     } else {
         // adding a new type
         $title = "Create a new type";
         $help = 'Use this form to create a new type';
     }
     $this->config->set_item('replacer', array('types' => array('/types/index|Types'), 'edit' => $title, 'add' => $title));
     $title_options = array('title' => $title, 'help' => $help, 'expand' => 'page', 'icons' => array());
     $pageDetails = array('title' => $title, 'title_options' => $title_options, 'content_view' => 'types/edit', 'id' => $id, 'feature_type' => 'Streamliner Core');
     $this->load->view('template/default', $pageDetails);
 }
예제 #15
0
 public function edit($tradesman_id = null)
 {
     require_capability('building:writetradesmen');
     if (!empty($tradesman_id)) {
         require_capability('building:edittradesmen');
         $tradesman_data = (array) $this->tradesman_model->get($tradesman_id);
         form_element::$default_data = $tradesman_data;
         // Set up title bar
         $title = "Edit Tradie";
         $help = "Use this form to edit the tradie.";
     } else {
         // adding a new tradesman
         $title = "Create a new tradie";
         $help = 'Use this form to create a new tradie.';
     }
     $this->config->set_item('replacer', array('building' => null, 'tradesmen' => array('/building/tradesmen/index|Tradies'), 'edit' => $title, 'add' => $title));
     $title_options = array('title' => $title, 'help' => $help, 'expand' => 'page', 'icons' => array());
     $pageDetails = array('title' => $title, 'title_options' => $title_options, 'content_view' => 'tradesmen/edit', 'tradesman_id' => $tradesman_id, 'types' => $this->tradesman_model->get_types_dropdown(), 'feature_type' => 'Custom feature', 'csstoload' => array());
     $this->load->view('template/default', $pageDetails);
 }
예제 #16
0
 function edit($contact_id = null)
 {
     if (empty($contact_id)) {
         require_capability('users:writecontacts');
         $title_options = array('title' => "Adding a new contact", 'help' => 'Use this page to add a new contact', 'icons' => array());
     } else {
         require_capability('users:editcontacts');
         $contact = $this->contact_model->get($contact_id);
         form_element::$default_data = (array) $contact;
         // Set up title bars
         $title_options = array('title' => "Editing contact " . $this->contact_model->get_name($contact), 'help' => 'Use this page to edit this contact\'s personal details, contact details, and account information', 'icons' => array());
     }
     $this->config->set_item('replacer', array('edit' => $title_options['title'], 'users' => array('/users/contact|Contacts')));
     $format_account_callback = function ($account) {
         $ci = get_instance();
         $formatted_account = $account->name;
         return $formatted_account;
     };
     $pageDetails = array('title' => $title_options['title'], 'title_options' => $title_options, 'accounts' => $this->account_model->get_dropdown('name', true, $format_account_callback), 'csstoload' => array(), 'contact_id' => $contact_id, 'type' => 'contact', 'types' => $this->contact_model->get_types_dropdown(), 'form_action' => base_url() . 'users/contact/process_edit', 'feature_type' => 'Streamliner Core', 'content_view' => 'users/contact/edit');
     $this->load->view('template/default', $pageDetails);
 }
예제 #17
0
 public function edit($account_id = null)
 {
     $account_data = array();
     if (!empty($account_id)) {
         require_capability('site:viewaccounts');
         $account_data = (array) $this->account_model->get_values($account_id);
         form_element::$default_data = $account_data;
         // Set up title bar
         $title = "Edit {$account_data['name']} billing account";
         $help = "Use this form to edit the {$account_data['name']} billing account.";
     } else {
         // adding a new account
         require_capability('site:writeaccounts');
         $title = "Create a new billing account";
         $help = 'Use this form to create a new billing account.';
     }
     $this->config->set_item('replacer', array('accounts' => array('/accounts/index|accounts'), 'edit' => $title, 'add' => $title));
     $title_options = array('title' => $title, 'help' => $help, 'expand' => 'page', 'icons' => array());
     $pageDetails = array('title' => $title, 'title_options' => $title_options, 'content_view' => 'account/edit', 'account_id' => $account_id, 'dropdowns' => array('street_types' => $this->street_type_model->get_dropdown('name')), 'account_data' => $account_data, 'csstoload' => array('jquery.autocomplete'), 'feature_type' => 'Streamliner Core');
     $this->load->view('template/default', $pageDetails);
 }
 public function edit($refrigerant_type_id = null)
 {
     $refrigerant_type_data = array();
     if (!empty($refrigerant_type_id)) {
         require_capability('site:viewrefrigerant_types');
         $refrigerant_type_data = (array) $this->refrigerant_type_model->get($refrigerant_type_id);
         form_element::$default_data = $refrigerant_type_data;
         // Set up title bar
         $title = "Edit {$refrigerant_type_data['name']} refrigerant_type";
         $help = "Use this form to edit the {$refrigerant_type_data['name']} refrigerant_type.";
     } else {
         // adding a new refrigerant_type
         require_capability('site:writerefrigerant_types');
         $title = "Create a new refrigerant_type";
         $help = 'Use this form to create a new refrigerant_type.';
     }
     $this->config->set_item('replacer', array('miniant' => array('/home|Administration'), 'refrigerant_types' => array('/miniant/refrigerant_types/index|Refrigerant types'), 'edit' => $title, 'add' => $title));
     $title_options = array('title' => $title, 'help' => $help, 'expand' => 'page', 'icons' => array());
     $pageDetails = array('title' => $title, 'title_options' => $title_options, 'content_view' => 'refrigerant_type/edit', 'refrigerant_type_id' => $refrigerant_type_id, 'dropdowns' => array('street_types' => $this->street_type_model->get_dropdown('name')), 'refrigerant_type_data' => $refrigerant_type_data, 'feature_type' => 'Custom feature', 'csstoload' => array());
     $this->load->view('template/default', $pageDetails);
 }
예제 #19
0
 public function edit($setting_id = null)
 {
     require_capability('site:writesettings');
     $setting = null;
     if (!empty($setting_id)) {
         require_capability('site:editsettings');
         $setting_data = (array) $this->setting_model->get($setting_id);
         form_element::$default_data = $setting_data;
         // Set up title bar
         $title = "Edit {$setting_data['name']} setting";
         $help = "Use this form to edit the {$setting_data['name']} setting.";
         $setting = $this->setting_model->get($setting_id);
     } else {
         // adding a new setting
         $title = "Create a new setting";
         $help = 'Use this form to create a new setting.';
     }
     $this->config->set_item('replacer', array('settings' => array('/settings/index|settings'), 'edit' => $title, 'add' => $title));
     $title_options = array('title' => $title, 'help' => $help, 'expand' => 'page', 'icons' => array());
     $pageDetails = array('title' => $title, 'top_title_options' => $title_options, 'content_view' => 'setting/edit', 'setting_id' => $setting_id, 'setting' => $setting, 'feature_type' => 'Streamliner Core');
     $this->load->view('template/default', $pageDetails);
 }
 public function edit($maintenance_contract_id = null)
 {
     $maintenance_contract_data = $this->maintenance_contract_model->get_values($maintenance_contract_id);
     $locked = false;
     if (!empty($maintenance_contract_id)) {
         require_capability('maintenance_contracts:editcontracts');
         $maintenance_contract_data['creation_date'] = unix_to_human($maintenance_contract_data['creation_date'], '%d/%m/%Y %h:%i');
         $maintenance_contract_data['next_maintenance_date'] = unix_to_human($maintenance_contract_data['next_maintenance_date'], '%d/%m/%Y %h:%i');
         form_element::$default_data = (array) $maintenance_contract_data;
         // Set up title bar
         $title = "Edit maintenance contract #{$maintenance_contract_id}";
         $help = "Use this form to edit the maintenance contract";
     } else {
         // adding a new maintenance_contract
         $title = "Create a new maintenance contract";
         $help = 'Use this form to create a new maintenance contract';
     }
     $post_vars = $this->input->post();
     if (!empty($post_vars)) {
         foreach ($post_vars as $var => $val) {
             form_element::$default_data[$var] = $val;
         }
     }
     $this->config->set_item('replacer', array('miniant' => array('/miniant/maintenance_contracts/index|Maintenance contracts')));
     $title_options = array('title' => $title, 'help' => $help, 'expand' => 'page', 'icons' => array());
     $jstoload = array('signaturepad/json2', 'maintenance_contracts/edit', 'application/messages');
     if (!empty($maintenance_contract_id)) {
         $jstoload[] = 'maintenance_contracts/units';
     }
     $dropdowns = $this->get_dropdowns();
     if (!empty($maintenance_contract_id)) {
         $this->db->where('account_id', $maintenance_contract_data['account_id']);
         $dropdowns['tenancies'] = $this->tenancy_model->get_dropdown('name', '-- Select a Tenancy/Owner --');
     } else {
         $dropdowns['tenancies'] = array();
     }
     $pageDetails = array('title' => $title, 'title_options' => $title_options, 'content_view' => 'maintenance_contract/edit', 'maintenance_contract_id' => $maintenance_contract_id, 'maintenance_contract_data' => $maintenance_contract_data, 'dropdowns' => $dropdowns, 'jstoloadinfooter' => $jstoload, 'module' => 'miniant', 'csstoload' => array('jquery.signaturepad'), 'feature_type' => 'Custom Feature');
     $this->load->view('template/default', $pageDetails);
 }
예제 #21
0
 public function edit($event_id = null, $system)
 {
     $this->load->helper('inflector');
     $event_data = $this->event_model->get_values($event_id);
     if (!empty($event_id)) {
         require_capability($system . ':editevents');
         form_element::$default_data = (array) $event_data;
         // Set up title bar
         $title = "Edit Event {$event_data['event_name']}";
         $help = "Use this form to edit the event";
     } else {
         // adding a new event
         $title = "Create a new event";
         $help = 'Use this form to create a new event';
     }
     $this->config->set_item('replacer', array('edit' => array("/events/browse/html/{$system}|{$system} events"), 'add' => array("/events/browse/html/{$system}|{$system} events"), $system => $title));
     $this->config->set_item('exclude', array('index', 'html', 'browse', 'events', 'edit'));
     $this->config->set_item('exclude_segment', array(2));
     $this->config->set_item('exclude', array('index', 'html', 'browse', 'events'));
     $title_options = array('title' => $title, 'help' => $help, 'expand' => 'page', 'icons' => array());
     $pageDetails = array('title' => $title, 'title_options' => $title_options, 'content_view' => 'events/edit', 'event_id' => $event_id, 'event_data' => $event_data, 'system' => $system, 'dropdowns' => $this->get_dropdowns(), 'feature_type' => 'Streamliner Core', 'jstoloadinfooter' => array('application/event_edit'));
     $this->load->view('template/default', $pageDetails);
 }
예제 #22
0
 public function edit($assignment_id)
 {
     require_capability('assignments:edit');
     $assignment_data = $this->assignment_model->get_values($assignment_id);
     if (empty($assignment_data)) {
         redirect(base_url() . 'miniant/orders/schedule');
     }
     $assignment_data->appointment_date = unix_to_human($assignment_data->appointment_date, '%d/%m/%Y %h:%i');
     $order = (object) $this->order_model->get_values($assignment_data->order_id);
     $order_type = $this->order_model->get_type_string($order->order_type_id);
     $statuses = $this->assignment_model->get_statuses($assignment_id, false);
     $current_statuses = array();
     if (!empty($statuses)) {
         foreach ($statuses as $status) {
             $current_statuses[] = $status->status_id;
         }
     }
     $allstatuses_array = $this->status_model->get_for_document_type('assignment');
     $allstatuses = array();
     foreach ($allstatuses_array as $status) {
         $allstatuses[$status->id] = $status->name;
     }
     $assigned_technicians = $this->assignment_model->get_assigned_technicians($order->id, $assignment_data->unit_id);
     $this->user_model->filter_by_role($this->role_model->get(array('name' => 'Technician'), true)->id);
     $technicians = $this->user_model->get_dropdown('first_name', false);
     form_element::$default_data = (array) $assignment_data;
     form_element::$default_data['technician_id'] = $assigned_technicians;
     form_element::$default_data['senior_technician_id'] = $order->senior_technician_id;
     // Set up title bar
     $title = "Edit {$assignment_data->reference_id} assignment";
     $help = "Use this form to edit the assignment";
     $this->config->set_item('replacer', array('miniant' => null, 'orders' => array('/miniant/orders/order|Jobs'), 'assignments' => array('/miniant/orders/schedule|Schedule'), 'edit' => $title, 'add' => $title));
     $title_options = array('title' => $title, 'help' => $help, 'expand' => 'page', 'icons' => array());
     $pageDetails = array('title' => $title, 'title_options' => $title_options, 'content_view' => 'assignments/edit', 'order_id' => $order->id, 'assignment_id' => $assignment_id, 'assignment_data' => $assignment_data, 'technicians' => $technicians, 'senior_technician_id' => $order->senior_technician_id, 'statuses' => $current_statuses, 'allstatuses' => $allstatuses, 'module' => 'miniant', 'feature_type' => 'Custom Feature', 'module' => 'miniant', 'assigned_technicians' => $assigned_technicians, 'priority_levels' => $this->priority_level_model->get_dropdown('name'), 'jstoloadinfooter' => array('orders/assignment_edit'), 'csstoload' => array());
     $this->load->view('template/default', $pageDetails);
 }
 public function __construct($label, $params, $required = false, $info_text = null)
 {
     parent::__construct($params['name'], $label, $required, $info_text);
     if ($this->default_value) {
         $params['checked'] = true;
     }
     $params['class'] = ' form-control';
     $this->html = form_radio($params);
 }
  function render_attributes()
  {
    $this->_process_attributes();

    if (!$this->path)
    {
      $action_path = $_SERVER['PHP_SELF'];

      $request = request :: instance();

      if($node_id = $request->get_attribute('node_id'))
        $action_path .= '?node_id=' . $node_id;
    }
    else
      $action_path = $this->path;

    if (strpos($action_path, '?') === false)
      $action_path .= '?';
    else
      $action_path .= '&';

    if($this->action)
      $action_path .= 'action=' . $this->action;

    if ((bool)$this->reload_parent)
    {
      $action_path .= '&reload_parent=1';
    }

    $window_name = '';
    if($this->target)
      $window_name = ", '{$this->target}'";

    $this->attributes['onclick'] = $this->onbeforeclick;
    $this->attributes['onclick'] .= $this->onclick;
    $this->attributes['onclick'] .= "submit_form(this.form, '{$action_path}'{$window_name});";
    $this->attributes['onclick'] .= $this->onafterclick;

    parent :: render_attributes();

    unset($this->attributes['onclick']);
  }
 /**
  * @param string $name
  * @param string $label
  * @param string $value
  * @param string $info_text
  * @param bool $checked
  * @param bool $required
  * @param string $class CSS rule class
  */
 public function __construct($params)
 {
     extract($params);
     parent::__construct($params);
     if ($this->default_value == $params['value']) {
         $params['checked'] = true;
     }
     if (!empty($params['class'])) {
         $this->classes[] = $params['class'];
     }
     $this->classes[] = 'radio';
     $params['class'] = $this->get_classes_string();
     if (!empty($params['required'])) {
         $params['data-required'] = true;
     }
     unset($params['required']);
     if (!empty($this->extra_html)) {
         foreach ($this->extra_html as $html_param => $value) {
             $params[$html_param] = $value;
         }
         unset($params['extra_html']);
     }
     $this->html = form_radio($params);
 }
예제 #26
0
 function edit($user_id)
 {
     $this->config->set_item('replacer', array('users' => array('/users/user|Staff')));
     if ($this->session->userdata('user_id') == $user_id) {
         require_capability('users:editownaccount', true, 'Your current permissions do not allow you to edit your own account details.');
     } else {
         require_capability('users:editusers');
     }
     $this->load->helper('dropdowns');
     $this->load->helper('secure_hash');
     $user = $this->user_model->get($user_id);
     form_element::$default_data = array('user_id' => $user_id, 'action' => 'edit_user', 'first_name' => $user->first_name, 'last_name' => $user->last_name, 'username' => $user->username);
     // Set up title bars
     $top_title_options = array('title' => "Editing Staff " . $this->user_model->get_name($user), 'help' => 'Use this page to edit this Staff\'s personal details, and contact details', 'icons' => array());
     $details_title_options = array('title' => "Personal Details", 'help' => null, 'level' => 2, 'icons' => array());
     $contacts_title_options = array('title' => "Contacts", 'help' => 'Use this section to add, edit or delete contact details.', 'level' => 2, 'icons' => array());
     $this->config->set_item('replacer', array('edit' => $top_title_options['title'], 'users' => array('/users/user|Staff')));
     $pageDetails = array('title' => $top_title_options['title'], 'top_title_options' => $top_title_options, 'details_title_options' => $details_title_options, 'contacts_title_options' => $contacts_title_options, 'feature_type' => 'Streamliner Core', 'csstoload' => array(), 'type' => 'staff', 'user_id' => $user_id, 'form_action' => base_url() . 'users/user/process_edit', 'jstoload' => array('jquery/jquery.domec', 'jquery/jquery.form', 'jquery/jquery.json', 'jquery/pause', 'jquery/jquery.selectboxes', 'application/users/user_edit'), 'content_view' => 'users/user/edit');
     $this->load->view('template/default', $pageDetails);
 }
예제 #27
0
 public function record_client_response($servicequote_id, $review_only = false)
 {
     require_capability('servicequotes:editsqs');
     $this->config->set_item('replacer', array('miniant' => null, 'servicequote' => array('/miniant/servicequotes/servicequote/browse|Service Quotes'), $servicequote_id => "SQ#{$servicequote_id} record client response", __FUNCTION__ => null));
     $servicequote = $this->servicequote_model->get($servicequote_id);
     $title = "Record client response for SQ #{$servicequote_id}";
     $help = "Record the client's response to the service quotation. If accepted, preview then send the purchase order(s) to the supplier(s).";
     $attachment = $this->servicequote_attachment_model->get(array('servicequote_id' => $servicequote_id), true);
     if (!empty($attachment->filename_original)) {
         $attachment->url = base_url() . "miniant/files/{$attachment->directory}/{$attachment->servicequote_id}/{$attachment->hash}";
     }
     form_element::$default_data = array('client_response' => $servicequote->client_response, 'client_response_notes' => $servicequote->client_response_notes);
     $title_options = array('title' => $title, 'help' => $help, 'expand' => 'page', 'icons' => array());
     $pageDetails = array('title' => $title, 'title_options' => $title_options, 'content_view' => 'servicequotes/template', 'content_stage' => 'record_client_response', 'attachment' => $attachment, 'review_only' => $review_only, 'module' => 'miniant', 'jstoload' => array('servicequotes/record_client_response'), 'csstoload' => array());
     foreach ($this->get_common_variables($servicequote_id, $review_only) as $var => $val) {
         $pageDetails[$var] = $val;
     }
     $this->load->view('template/default', $pageDetails);
 }
예제 #28
0
파일: input.php 프로젝트: s-kalaus/ekernel
 public function __construct($name, $param = array())
 {
     parent::__construct($name, $param);
     $this->type = isset($param['type']) ? $param['type'] : 'text';
 }
예제 #29
0
 public function edit($order_id = null)
 {
     $this->load->model('miniant/installation_template_model');
     $this->load->model('miniant/tenancy_model');
     if (empty($order_id)) {
         require_capability('orders:writeorders');
     } else {
         require_capability('orders:editorders');
     }
     $order_data = $this->order_model->get_values($order_id);
     $locked = false;
     if (!empty($order_id)) {
         require_capability('orders:editorders');
         $order_data['call_date'] = unix_to_human($order_data['call_date'], '%d/%m/%Y %h:%i');
         $order_data['maintenance_preferred_start_date'] = unix_to_human($order_data['preferred_start_date'], '%d/%m/%Y');
         $order_data['preferred_start_date'] = unix_to_human($order_data['preferred_start_date'], '%d/%m/%Y %h:%i');
         form_element::$default_data = (array) $order_data;
         if (!empty(form_element::$default_data['attachment'])) {
             form_element::$default_data['attachment'] = $order_data['attachment']->filename_original;
         }
         if ($this->order_model->has_statuses($order_id, array('AWAITING REVIEW'))) {
             trigger_event('lock_for_review', 'orders', $order_id, false, 'miniant');
         }
         if (has_capability('orders:allocateorders') && $this->order_model->has_statuses($order_id, array('LOCKED FOR AMENDMENT'))) {
             add_message('This job is currently being amended by the technician, and is not editable', 'warning');
             $locked = true;
         }
         // Set up title bar
         $title = "Edit Job J{$order_id}";
         // TODO add invoice number
         $help = "Use this form to edit the job";
     } else {
         // adding a new job
         $title = "Create a new job";
         $help = 'Use this form to create a new job';
     }
     $post_vars = $this->input->post();
     if (!empty($post_vars)) {
         foreach ($post_vars as $var => $val) {
             form_element::$default_data[$var] = $val;
         }
     }
     $this->config->set_item('replacer', array('miniant' => null, 'order' => array('/miniant/orders/order/index|Jobs'), 'edit' => $title, 'add' => $title));
     $title_options = array('title' => $title, 'help' => $help, 'expand' => 'page', 'icons' => array());
     $jstoload = array('jquery.signaturepad', 'signaturepad/flashcanvas', 'signaturepad/json2', 'orders/order_edit', 'application/messages');
     $is_service = $order_data['order_type_id'] == $this->order_model->get_type_id('Service');
     $is_repair = $order_data['order_type_id'] == $this->order_model->get_type_id('Repair');
     $is_maintenance = $order_data['order_type_id'] == $this->order_model->get_type_id('Maintenance');
     $is_installation = $order_data['order_type_id'] == $this->order_model->get_type_id('Installation');
     if (!empty($order_id)) {
         if ($is_maintenance || $is_service) {
             $jstoload[] = 'orders/order_units_maintenance';
         } else {
             if ($is_installation) {
                 $jstoload[] = 'orders/order_units_installation';
             } else {
                 if ($is_repair) {
                     $jstoload[] = 'orders/order_units_repair';
                 } else {
                     $jstoload[] = 'orders/order_units';
                 }
             }
         }
     }
     $dropdowns = $this->get_dropdowns();
     // Remove any unit type that doesn't have a task template in the DB
     if ($is_installation) {
         foreach ($dropdowns['unit_types'] as $unit_type_id => $unit_type_name) {
             if ($unit_type_id < 1) {
                 continue;
             }
             if (!$this->installation_template_model->get(array('unit_type_id' => $unit_type_id))) {
                 unset($dropdowns['unit_types'][$unit_type_id]);
             }
         }
     }
     if (!empty($order_id)) {
         $this->db->where('account_id', $order_data['account_id']);
         $dropdowns['tenancies'] = $this->tenancy_model->get_dropdown('name', '-- Select a Tenancy/Owner --');
     } else {
         unset($dropdowns['order_types'][$this->order_model->get_type_id('Repair')]);
         $dropdowns['tenancies'] = array();
     }
     $pageDetails = array('title' => $title, 'title_options' => $title_options, 'content_view' => 'orders/order/edit', 'order_id' => $order_id, 'order_data' => $order_data, 'locked' => $locked, 'submit_buttons' => $this->get_submit_buttons($order_id), 'dropdowns' => $dropdowns, 'jstoloadinfooter' => $jstoload, 'csstoload' => array('jquery.signaturepad'), 'is_maintenance' => $is_maintenance, 'is_service' => $is_service, 'is_repair' => $is_repair, 'feature_type' => 'Custom Feature', 'is_installation' => $is_installation, 'module' => 'miniant', 'csstoload' => array());
     $this->load->view('template/default', $pageDetails);
 }