Example #1
0
 public function edit()
 {
     parent::edit();
     $whtransfer = new WHTransfer();
     $whtransfer->load($this->_data['id']);
     $this->view->set('whtransfer', $whtransfer);
     $stitems = STBalance::getStockList($whtransfer->from_whlocation_id);
     $this->view->set('stitems', $stitems);
     $this->_templateName = $this->getTemplateName('_new');
 }
 public function edit()
 {
     //If the user is HR Admin
     if (ismoduleadmin()) {
         parent::edit();
     } else {
         $flash = Flash::Instance();
         $flash->addError('You do not have permission to edit a Holiday Extra Day!');
         sendTo();
     }
 }
 public function edit()
 {
     $flash = Flash::Instance();
     parent::edit();
     $modulecomponent = $this->_uses[$this->modeltype];
     $this->addSidebar($modulecomponent);
     switch ($modulecomponent->type) {
         case 'C':
             break;
         case 'M':
             $model = new $modulecomponent->name();
             $fields = $model->getFields();
             $current_defaults = array();
             foreach ($modulecomponent->module_defaults as $default) {
                 $current_defaults[$default->field_name] = $default->id;
             }
             foreach ($fields as $field) {
                 if (isset($current_defaults[$field->name])) {
                     $field->id = $current_defaults[$field->name];
                 }
             }
             $this->view->set('model_class', $model);
             $this->view->set('models', array($modulecomponent->name => $model));
             $this->view->set('fields', $fields);
             $this->view->set('type', 'display');
             if (is_null($modulecomponent->title)) {
                 $modulecomponent->title = $model->getTitle();
             }
             if ($model instanceof DataObject) {
                 $this->view->set('internal_type', 'DataObject');
             } elseif ($model instanceof DataObjectCollection) {
                 $this->view->set('internal_type', 'DataObjectCollection');
             }
             $this->view->set('version', $model->version());
             break;
         default:
             $flash->addWarning('Edit of ' . $modulecomponent->getEnum('type', $modulecomponent->type) . ' not allowed');
             sendback();
     }
     $this->view->set('ModuleComponent', $modulecomponent);
 }
Example #4
0
 public function edit()
 {
     if (!isset($this->_data) || !$this->loadData()) {
         // we are editing data, but either no id has been provided
         // or the data for the supplied id does not exist
         // or access to the record is denied
         $this->dataError($this->_no_access_msg);
         sendBack();
     }
     parent::edit();
 }
 public function edit()
 {
     $this->view->set('field_name', $this->_data['field_name']);
     $modulecomponent = new ModuleComponent();
     $modulecomponent->load($this->_data['module_components_id']);
     $model = new $modulecomponent->name();
     $field = $model->getField($this->_data['field_name']);
     $this->view->set('field', $field);
     if (isset($model->belongsToField[$field->name])) {
         $x = $model->belongsTo[$model->belongsToField[$field->name]]["model"];
         $cc = new ConstraintChain();
         if ($model->belongsTo[$model->belongsToField[$field->name]]["cc"] instanceof ConstraintChain) {
             $cc->add($model->belongsTo[$model->belongsToField[$field->name]]["cc"]);
         }
         $x = new $x();
         $this->view->set('options', $x->getAll($cc));
         $field->type = 'select';
     }
     if ($model->isEnum($field->name)) {
         $this->view->set('options', $model->getEnumOptions($field->name));
         $field->type = 'select';
     }
     if (empty($this->_data['id'])) {
         //			sendTo($this->name,'new',$this->_modules);
         unset($this->_data['id']);
         $this->view->set('module_components_id', $this->_data['module_components_id']);
         parent::_new();
         $this->_templateName = $this->getTemplateName('new');
     } else {
         parent::edit();
     }
 }
 public function edit()
 {
     parent::edit();
     $this->view->set('edit', true);
 }
Example #7
0
 public function edit()
 {
     parent::edit();
     $this->setTemplateName('calls_new');
 }
Example #8
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);
require 'Controller.php';
require 'Model.php';
require 'View.php';
$page = !empty($_GET['page']) ? $_GET['page'] : null;
$controller = new Controller();
switch ($page) {
    case 'articles':
    default:
        $controller->articles();
        break;
    case 'detail':
        $id = $_GET['id'];
        $controller->detail($id);
        break;
    case 'edit':
        $id = $_GET['id'];
        $controller->edit($id);
        break;
    case 'delete':
        $id = $_GET['id'];
        $controller->delete($id);
        break;
}