public function tree($modules = null) { if (is_null($modules)) { $modules = $this->getOption('modulesToList'); } $officeConfig = PEAR::getStaticProperty('m_office', 'options'); $moduleconf = $officeConfig['modules']; $diff = array_diff(array_keys($_GET), array('module')); $o = array(); foreach ($modules as $id => $module) { if (is_array($module)) { if (!can('tab', $id)) { continue; } $res = array('name' => $id, 'icon' => $moduleconf[$id]['icon']); $res['submodules'] = $this->tree($module); if (in_array($_REQUEST['module'], $module)) { $res['expanded'] = true; } } else { if (!can('tab', $module)) { continue; } $res = array('name' => $module, 'icon' => $moduleconf[$module]['icon'], 'url' => M_Office::URL($module, array(), $diff)); if ($_REQUEST['module'] == $module || $_REQUEST['module'] == $module . 'helper') { $res['active'] = true; } } $o[] = $res; } return $o; }
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 loginForm($table) { $form = new MyQuickForm('loginform', 'POST', M_Office_Util::getQueryParams(array(), array(), false), '_self', null, true); $authDO = DB_DataObject::factory($table); $authDO->prepareForLogin(false, false); $authFB = MyFB::create($authDO); $authFB->useForm($form); $authFB->getForm(); if ($form->validate()) { M_Office_Util::refresh($_SERVER['REQUEST_URI']); } M_Office::$dsp = 'login'; $this->assign('loginForm', $form); }
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; }
public function doExecAdd() { $form = new MyQuickForm('addform', 'POST', M_Office::URL()); $p = DB_DataObject::factory('photo'); $p->record_table = $_GET['table']; $p->record_id = $_GET['record']; $fb = MyFB::create($p); $fb->useForm($form); $fb->getForm(); if ($form->validate()) { // trigger_error('form validate') $form->process(array($fb, 'processForm'), false); $this->assign('success', 1); } $this->assign('form', $form); }
/** * Redirects to another url (uses javascript is some headers were already sent, or javascript if current request was an ajax request) * @param url string url to redirect to */ public static function refresh($url = false) { if (empty($url) || substr($url, 0, 4) !== 'http') { $url = 'http' . (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . (!empty($url) && $url[0] == '/' ? '' : (empty($url) || $url[0] == '?' ? $_SERVER['PHP_SELF'] : dirname($_SERVER['PHP_SELF']) . '/')) . $url; } if (stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE') && stristr($_SERVER['HTTP_USER_AGENT'], 'Mac') || headers_sent()) { echo '<script>location.replace("' . $url . '");</script> <noscript> <meta http-equiv="Refresh" content="0; URL=' . $url . '"/> </noscript> Please <a href="' . $url . '">click here</a> to continue. '; } elseif (M_Office::isAjaxRequest()) { echo 'Please <a class="refresh_url_link" href="' . $url . '">click here</a> to continue.' . '<script>$(".refresh_url_link").click().hide();</script>'; } else { header('Location: ' . $url); } exit; }
/** * In case of a multi-page action, redirects to the next step */ public function nextStep($result) { list($step, $timeout) = $this->getStepInfo(); M_Office_Util::postRedirect(M_Office::URL(array('__start' => $result->next)), $_POST, array('actionstep_' . $this->actionName, 'actionstep'), array('start' => $result->next, 'timeout' => $timeout * 1000, 'total' => $result->total, 'actionName' => $this->getActionTitle())); }
public function fetch() { try { $tpl = Mreg::get('tpl'); $tpl->concat('adminTitle', ' :: ' . $this->getOption('adminTitle')); if (self::isAjaxRequest()) { M_Office::$dsp = '__defaut/ajaxindex'; $vars = $tpl->getVars(); $action = $vars['__action']; if (!is_array($action)) { $tpl->assign('__action', array($action . '.bloc', $action)); } } $tables = $this->getGlobalOption('searchInTables', 'frontendhome'); if (array_key_exists('flashmessages', $_SESSION)) { $tpl->assign('messages', $_SESSION['flashmessages']); } if (count($tables) == 0) { $tpl->assign('showlivesearch', false); } else { $tpl->assign('showlivesearch', true); } return $tpl->fetch(M_Office::$dsp); } catch (Exception $e) { M_Office::$dsp = '__defaut/error'; $tpl->assign('message', $e->getMessage()); $tpl->assign('error', $e); return $tpl->fetch(M_Office::$dsp); } }
?> _<?php echo $record->pk(); ?> "><?php _e('%s images', array($cnt)); ?> </a> - <a id="addphotolink_<?php echo $record->tableName(); ?> _<?php echo $record->pk(); ?> " href="<?php echo M_Office::URL('otfimage:photohelper/add', array('record' => $record->pk(), 'table' => $record->tableName())); ?> "><?php _e('Add image'); ?> </a> <?php echo $this->getCapture('imagelist'); ?> <?php $this->startCapture('js'); ?> if(typeof(initpheditor)=='function') { initpheditor('<?php
<?php /** * M PHP Framework * @package M */ /** * M PHP Framework * * Controller main file for office app * * @package M * @author Arnaud Sellenet <demental at github> * @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License * @version 0.1 */ define('APP_NAME', '{$APP_NAME}'); define('IN_ADMIN', 1); require '{$APP_RELATIVE_FILE_TO_ROOT}/M_startup.php'; require 'M/Office.php'; define('ROOT_ADMIN_URL', SITE_URL . '{$APP_RELATIVE_FILE_FROM_DOCROOT}'); Mreg::get('setup')->setUpEnv(); $frontend = new M_Office(); header('Content-type:text/html; charset=utf-8'); echo $frontend->display();
public function doExecRedirect() { $redirmodule = $_REQUEST['targetmodule']; $extag = explode(',', $_REQUEST['ex_tag']); $intag = explode(',', $_REQUEST['int_tag']); foreach ($extag as $tagname) { $t = DB_DataObject::factory('tag'); $t->strip = $tagname; if ($t->find(true)) { $extagid[$t->id] = 1; } } foreach ($intag as $tagname) { $t = DB_DataObject::factory('tag'); $t->strip = $tagname; if ($t->find(true)) { $intagid[$t->id] = 1; } } $this->redirect(M_Office::URL(array('module' => $redirmodule, 'exc__tags' => $extagid, '_tags' => $intagid), array('targetmodule', 'ex_tag', 'int_tag'))); }
" /> <button class="btn-xs btn-danger"><i class="fa fa-times"></i></button> </form> <?php echo $tag; ?> </span> <?php } ?> <span class="badge badge-primary"> <form method="post" action="<?php echo M_Office::URL('tag:taghelper/addbystrip', array('focustable' => $focus->tableName(), 'focusid' => $focus->pk(), 'focusmodule' => $module)); ?> "> <input type="hidden" name="target" value="<?php echo M_Office::URL(); ?> " /> <input type="text" name="strip" id="addtag_<?php echo $focus->tableName(); ?> _<?php echo $focus->pk(); ?> " size="20"/> <button class="btn btn-xs btn-primary"><i class="fa fa-plus"></i></button> </form> </span> </div> <?php echo $this->c('tag:taghelper', 'autocomplete', array('field' => 'addtag_' . $focus->tableName() . '_' . $focus->pk()));
<h1><?php _e('Plugins:Tag Manager'); ?> </h1> <ul> <li><a href="<?php echo M_Office::URL('tag:admin/cloud'); ?> ">View cloud</a></li> <li><a href="<?php echo M_Office::URL('tag:admin/merger'); ?> ">Tag merger</a></li> <li><a href="<?php echo M_Office::URL('tag:admin/manager'); ?> ">Tag manager (archiving and deletion)</a></li> <li><a href="<?php echo M_Office::URL('tag:admin/applier'); ?> ">Tag applier / remover</a></li> <li><a href="<?php echo M_Office::URL('tag:admin/stats'); ?> ">Statistics</a></li> </ul>
public function testWithNamePrefix() { T::setLang('fr'); $t = DB_DataObject::factory('formtest'); $t->fb_elementNamePrefix = 'test'; $fb = MyFB::create($t); $form = new MyQuickForm('testform', 'POST', M_Office::URL()); $post = array_merge($form->exportValues(), array('testtitre_group' => array('testtitre_fr' => 'Test titre', 'testtitre_en' => 'title', 'testtitre_es' => 'titulo'), 'testdescription_group' => array('testdescription_fr' => 'Nouv desc 2 FR', 'testdescription_en' => null, 'testdescription_es' => 'Nueva desc 2 ES'), 'testpays' => 'ma', 'testtestuser_id' => 1, '_qf__' . $form->getAttribute('name') => 1, 'testi18n_id_fr' => '', 'testi18n_id_en' => '', 'testi18n_id_es' => '', 'testid' => '')); $get = $_GET; $request = array_merge($get, $post); $form->initRequest($get, $post, $request); $fb->useForm($form); $fb->getForm(); $form->validate(); $form->process(array($fb, 'processForm'), false); T::setLang('es'); $t2 = DB_DataObject::factory('formtest'); $t2->get($t->id); $this->assertEqual($t2->titre, 'titulo'); T::setLang('en'); $t2 = DB_DataObject::factory('formtest'); $t2->get($t->id); $this->assertEqual($t2->titre, 'title'); }
?> </td> <td><?php echo $tag->nbtagged(); ?> </td> <td><?php echo $tag->nbwasAdded(); ?> times</td> <td><?php echo $tag->nbwasRemoved(); ?> times</td> <td><a class="del" href="<?php echo M_Office::URL('tag:admin/delete', array('id' => $tag->id)); ?> "><img src="/images/icons/cross.png" /></a></td> </tr> <?php } ?> </tbody> </table> <?php $this->startCapture('js'); ?> $('.tagmanager a.del').click(function(){ return confirm('Are you sure ???? THIS CANNOT BE UNDONE !!'); })