public function __construct() { parent::__construct(); $tpl = new Mtpl(array('M/Office/Templates/', APP_ROOT . 'app/' . APP_NAME . '/templates/', APP_ROOT . 'public/themes/' . Config::getPref('theme') . '/templates/')); $this->assign('output', $tpl->fetch('home')); $this->assign('__action', 'dyn'); }
function __construct($searchtext, $expandTable = null) { parent::__construct(); $this->searchtext = trim($searchtext); $this->expand = $expandTable !== null; $this->expandTable = $expandTable; M_Office::$dsp = '__defaut/ajaxindex'; }
public function __construct($module, $record) { $opts = PEAR::getStaticProperty('m_office', 'options'); $this->module = $module; $this->assign('module', $module); $this->__record_id = $record; $this->moduloptions = $opts['modules'][$module]; $table = $this->table = $this->moduloptions['table']; parent::__construct(); }
public function __construct($parentDo, $parentModule, $linkTable, $linkField, $value) { parent::__construct(); $this->parentDo = $parentDo; $this->parentModule = $parentModule; $this->table = $linkTable; $this->module = $linkTable; $this->field = $linkField; $this->value = $value; }
public function __construct() { parent::__construct(); if (key_exists('logout', $_REQUEST)) { User::getInstance('office')->logout(); M_Office_Util::refresh(); } if (!User::getInstance('office')->isLoggedIn()) { $this->loginForm(User::getInstance('office')->containers['office']['table']); } }
public function __construct($module) { parent::__construct(); $this->assign('__action', 'add'); $tpl = Mreg::get('tpl'); $tpl->concat('adminTitle', ' :: ' . $this->moduloptions['title'] . ' :: ' . __('Add record')); $mopts = PEAR::getStaticProperty('m_office', 'options'); $mopt = $mopts['modules'][$module]; $table = $mopt['table']; $do = M_Office_Util::doForModule($module); $this->append('subActions', '<a href="' . M_Office_Util::getQueryParams(array(), array('record', 'doSingleAction')) . '">' . __('Go to the %s list', array($mopt['title'])) . '</a>'); $formBuilder =& MyFB::create($do); // linkNewValue creates an issue if some linked elements are put in predefgroups // $formBuilder->linkNewValue = true; $form = new MyQuickForm('editRecord', 'POST', M_Office_Util::getQueryParams(array(), array(), false), '_self', null, true); $form->addElement('hidden', 'submittedNewRecord', 1); if (isset($_REQUEST['filterField'])) { $form->addElement('hidden', 'filterField', $_REQUEST['filterField']); $form->addElement('hidden', 'filterValue', $_REQUEST['filterValue']); $do->{$_REQUEST['filterField']} = $_REQUEST['filterValue']; } $links = $do->links(); if (key_exists($_REQUEST['filterField'], $links)) { $linfo = explode(':', $links[$_REQUEST['filterField']]); $form->addElement('static', 'mod', '', __('Add record with %s = %s', array($_REQUEST['filterField'], $_REQUEST['filterValue'])) . '. ' . '<a href="' . M_Office_Util::getQueryParams(array('table' => $linfo[0], 'record' => $_REQUEST['filterValue']), array('addRecord', 'filterField', 'filterValue')) . '">' . __('Back to main record') . '</a>'); } $formBuilder->useForm($form); $formBuilder->getForm(); if ($this->getOption('createAnother', $table)) { $form->addElement('static', ' ', ' '); $form->addElement('checkbox', 'returnHere', __('Create another record')); if (isset($_REQUEST['returnHere']) && $_REQUEST['returnHere']) { $form->setDefaults(array('returnHere' => true)); } } M_Office_Util::addHiddenFields($form); if ($form->validate()) { if (PEAR::isError($ret = $form->process(array(&$formBuilder, 'processForm'), false))) { $this->append('error', __('An error occured while inserting record') . ' : ' . $ret->getMessage()); } else { $pk = DB_DataObject_FormBuilder::_getPrimaryKey($do); $this->say(__('New record was successfully created. Its identifier is : %s', array($do->{$pk}))); if ($this->getOption('createAnother', $table) && isset($_REQUEST['returnHere']) && $_REQUEST['returnHere']) { M_Office_Util::refresh(M_Office_Util::getQueryParams(array('returnHere' => $_REQUEST['returnHere']), array(), false)); } else { $pk = DB_DataObject_FormBuilder::_getPrimaryKey($do); M_Office_Util::refresh(M_Office_Util::getQueryParams(array('record' => $do->{$pk}), array('returnHere', 'addRecord'), false)); } } } elseif ($form->isSubmitted()) { } $this->assign('addForm', $form); $this->assign('do', $do); }
public function __construct($layout = 'main') { parent::__construct(); $setup = new M_Office_Setup($this); $setup->setup(); try { $this->run(); } catch (Exception $e) { M_Office::$dsp = '__defaut/error'; Mreg::get('tpl')->assign('__action', 'error'); Mreg::get('tpl')->assign('message', $e->getMessage()); Mreg::get('tpl')->assign('error', $e); } }
/** * @param $options array of options */ public function __construct($options) { parent::__construct($options); $this->has_output = false; $this->nextactions = explode(',', $_REQUEST['__actionchain']); if (empty($this->nextactions[0]) && !empty($_REQUEST['__nextaction'])) { $this->nextactions = array($_REQUEST['__nextaction']); } if (empty($this->nextactions[0])) { $this->nextactions = array(); } $this->target = count($this->nextactions) > 0 ? 'nextaction' : $_REQUEST['__target']; $this->__start = $_REQUEST['__start'] < 1 ? 0 : $_REQUEST['__start']; $this->__step = null; }
public function __construct($do, $delete) { parent::__construct(); foreach ($delete as $deleteId) { $deldo = DB_DataObject::factory($do->tableName()); $deldo->get($deleteId); if ($deldo->delete()) { $this->say(__('Record # %s was deleted', array($deleteId))); } unset($deldo); } $this->say(__('The selected records were deleted')); M_Office_Util::refresh(M_Office::URL($this->_initRequest($_POST))); return; }
function M_Office_treesort() { M_Office_Controller::M_Office_Controller(); }
function __construct() { parent::__construct(); }
function __construct($module) { parent::__construct(); $this->assign('module', $module); $this->module = $module; deny_unless_can('read', $module); if ((isset($_REQUEST['record']) || isset($_REQUEST['__record_ref'])) && ($this->getOption('edit', $module) || $this->getOption('view', $module))) { $subController = new M_Office_EditRecord($module, $_REQUEST['record'], $additionalFilter); $subController->__record_ref = $_REQUEST['__record_ref']; $subController->run(); return; } if (isset($_REQUEST['addRecord']) && $this->getOption('add', $module)) { deny_unless_can('create', $module); $subController = new M_Office_AddRecord($module); $subController->run(); return; } $opts = PEAR::getStaticProperty('m_office', 'options'); $this->moduloptions = $opts['modules'][$module]; $this->table = $this->moduloptions['table']; if (!$this->getOption('view', $module)) { M_Office_Util::refresh(ROOT_ADMIN_URL . ROOT_ADMIN_SCRIPT); } if ($this->getOption('search', $module)) { // 1. Url curation if needed // if(!key_exists('_c_',$_REQUEST) && !M_Office::isAjaxRequest()) { // M_Office_Util::refresh(M_Office::cleanURL(array('_c_'=>1),array('searchSubmit','__submit__'))); // } // 2. Process search $doSearch = M_Office_Util::doForModule($this->module); $searchForm = M_Office_Util::getSearchForm($doSearch, $this->module); $this->assign('search', $searchForm); $searchValues = $searchForm->exportValues(); } else { $searchValues = array(); } $do = $this->getSearchDO($searchValues); if (isset($_REQUEST['doaction']) && $this->getOption('actions', $module)) { $order = trim($_REQUEST['_ps'] . ' ' . $_REQUEST['_pd']); if ($order) { $do->orderBy(); $do->orderBy($order); } $subController = new M_Office_Actions($this->getOptions()); $subController->run($do, $_REQUEST['doaction'], 'batch'); if ($subController->has_output) { return; } } elseif (isset($_REQUEST['glaction']) && $this->getOption('actions', $module)) { $subController = new M_Office_Actions($this->getOptions()); $subController->run($do, $_REQUEST['glaction'], 'global'); if ($subController->has_output) { return; } } if ($this->getAndProcessActions(clone $do, $module)) { return; } if ($this->getOption('view', $this->module) === TRUE) { $dg = new M_Office_View_DOPaging($this); $this->assign('__listview', 'dopaging'); } else { $class = 'M_Office_View_' . $this->getOption('view', $this->module); $dg = new $class($this); $this->assign('__listview', $this->getOption('view', $this->module)); } $tpl = Mreg::get('tpl'); $do_before_fetch = clone $do; $tpl->assign('do_before_fetch', $do_before_fetch); $tpl->concat('adminTitle', $this->moduloptions['title'] . ' :: Listing'); $tpl->assign('adminHeader', $this->moduloptions['title']); $pagination = $this->paginate === false ? false : true; $dg->prepare($do, $this->module, $pagination); $this->assign('dg', $dg); $this->assign('total', $total); $this->assign('pager', $dg->getPaging()); $this->assign('fields', $dg->getFields()); $this->assign('__action', 'showtable'); $deleteForm = new MyQuickForm('showTableForm', 'post', M_Office_Util::getQueryParams(array(), array()), '_self', null, true); M_Office_Util::addHiddenFields($deleteForm, array(), true); }