/** * $Id: rating.php 159 2007-12-17 16:44:05Z malanciault $ * Module: Class_Booking * Author: The SmartFactory <www.smartfactory.ca> * Licence: GNU */ function editclass($showmenu = false, $ratingid = 0) { global $smartobject_rating_handler; $ratingObj = $smartobject_rating_handler->get($ratingid); if (!$ratingObj->isNew()) { if ($showmenu) { smart_adminMenu(4, _AM_SOBJECT_RATINGS . " > " . _AM_SOBJECT_EDITING); } smart_collapsableBar('ratingedit', _AM_SOBJECT_RATINGS_EDIT, _AM_SOBJECT_RATINGS_EDIT_INFO); $sform = $ratingObj->getForm(_AM_SOBJECT_RATINGS_EDIT, 'addrating'); $sform->display(); smart_close_collapsable('ratingedit'); } else { $ratingObj->hideFieldFromForm(array('item', 'itemid', 'uid', 'date', 'rate')); if (isset($_POST['op'])) { $controller = new SmartObjectController($smartobject_rating_handler); $controller->postDataToObject($ratingObj); if ($_POST['op'] == 'changedField') { switch ($_POST['changedField']) { case 'dirname': $ratingObj->showFieldOnForm(array('item', 'itemid', 'uid', 'date', 'rate')); break; } } } if ($showmenu) { smart_adminMenu(4, _AM_SOBJECT_RATINGS . " > " . _CO_SOBJECT_CREATINGNEW); } smart_collapsableBar('ratingcreate', _AM_SOBJECT_RATINGS_CREATE, _AM_SOBJECT_RATINGS_CREATE_INFO); $sform = $ratingObj->getForm(_AM_SOBJECT_RATINGS_CREATE, 'addrating'); $sform->display(); smart_close_collapsable('ratingcreate'); } }
/** * Create the complete path of a category * * @todo this could be improved as it uses multiple queries * @param bool $withAllLink make all name clickable * @return string complete path (breadcrumb) */ function getCategoryPath($withAllLink = true, $currentCategory = false) { include_once SMARTOBJECT_ROOT_PATH . "class/smartobjectcontroller.php"; $controller = new SmartObjectController($this->handler); if (!$this->_categoryPath) { if ($withAllLink && !$currentCategory) { $ret = $controller->getItemLink($this); } else { $currentCategory = false; $ret = $this->getVar('name'); } $parentid = $this->getVar('parentid'); if ($parentid != 0) { $parentObj =& $this->handler->get($parentid); if ($parentObj->isNew()) { exit; } $parentid = $parentObj->getVar('parentid'); $ret = $parentObj->getCategoryPath($withAllLink, $currentCategory) . " > " . $ret; } $this->_categoryPath = $ret; } return $this->_categoryPath; }
function createTableRow($object, $level = 0) { $aObject = array(); $i = 0; $aColumns = array(); $doWeHaveActions = false; foreach ($this->_columns as $column) { $aColumn = array(); if ($i == 0) { $class = "head"; } elseif ($i % 2 == 0) { $class = "even"; } else { $class = "odd"; } if ($column->_customMethodForValue && method_exists($object, $column->_customMethodForValue)) { $method = $column->_customMethodForValue; $value = $object->{$method}(); } else { /** * If the column is the identifier, then put a link on it */ if ($column->getKeyName() == $this->_objectHandler->identifierName) { $value = $object->getItemLink(); } else { $value = $object->getVar($column->getKeyName()); } } $space = ''; if ($column->getKeyName() == $this->_objectHandler->identifierName) { for ($i = 0; $i < $level; $i++) { $space = $space . '--'; } } if ($space != '') { $space .= ' '; } $aColumn['value'] = $space . $value; $aColumn['class'] = $class; $aColumn['width'] = $column->getWidth(); $aColumn['align'] = $column->getAlign(); $aColumn['key'] = $column->getKeyName(); $aColumns[] = $aColumn; $i++; } $aObject['columns'] = $aColumns; $class = $class == 'even' ? 'odd' : 'even'; $aObject['class'] = $class; $actions = array(); // Adding the custom actions if any foreach ($this->_custom_actions as $action) { if (method_exists($object, $action)) { $actions[] = $object->{$action}(); } } include_once SMARTOBJECT_ROOT_PATH . "class/smartobjectcontroller.php"; $controller = new SmartObjectController($this->_objectHandler); if (in_array('edit', $this->_actions)) { $actions[] = $controller->getEditItemLink($object, false, true); } if (in_array('delete', $this->_actions)) { $actions[] = $controller->getDeleteItemLink($object, false, true); } $aObject['actions'] = $actions; $this->_tpl->assign('smartobject_actions_column_width', count($actions) * 30); $aObject['id'] = $object->id(); $this->_aObjects[] = $aObject; $childrenObjects = $this->getChildrenOf($object->id()); $this->_hasActions = $this->_hasActions ? true : count($actions) > 0; if ($childrenObjects) { $level++; foreach ($childrenObjects as $subObject) { $this->createTableRow($subObject, $level); } } }
} if (isset($_POST['op'])) { $op = $_POST['op']; } $tagid = isset($_GET['tagid']) ? $_GET['tagid'] : 0; $fct = isset($_GET['fct']) ? $_GET['fct'] : ''; $language = isset($_GET['language']) ? $_GET['language'] : false; switch ($op) { case "del": include_once XOOPS_ROOT_PATH . "/modules/smartobject/class/smartobjectcontroller.php"; $controller = new SmartObjectController($smartobject_tag_handler); $controller->handleObjectDeletion(_AM_SOBJECT_TAG_DELETE_CONFIRM); break; case "addtag": include_once XOOPS_ROOT_PATH . "/modules/smartobject/class/smartobjectcontroller.php"; $controller = new SmartObjectController($smartobject_tag_handler); $tagObj = $controller->storeSmartObject(); if ($tagObj->hasError()) { redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors()); exit; } if ($tagObj->hasError()) { redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors()); } else { redirect_header(smart_get_page_before_form(), 3, _CO_SOBJECT_SAVE_SUCCESS); } exit; break; case "mod": smart_xoops_cp_header(); edittag($tagid, $language, $fct);
foreach($currenciesObj as $currencyid=>$currencyObj) { //$bookingObj->setVar('attended', isset($_POST['attended_' . $bookingid]) ? intval($_POST['attended_' . $bookingid]) : 0); $smartobject_currency_handler->insert($currencyObj); } */ redirect_header($smart_previous_page, 3, _AM_SOBJECT_RECORDS_UPDATED); exit; break; case "addcurrency": include_once XOOPS_ROOT_PATH . "/modules/smartobject/class/smartobjectcontroller.php"; $controller = new SmartObjectController($smartobject_currency_handler); $controller->storeFromDefaultForm(_AM_SOBJECT_CURRENCIES_CREATED, _AM_SOBJECT_CURRENCIES_MODIFIED, SMARTOBJECT_URL . 'admin/currency.php'); break; case "del": include_once XOOPS_ROOT_PATH . "/modules/smartobject/class/smartobjectcontroller.php"; $controller = new SmartObjectController($smartobject_currency_handler); $controller->handleObjectDeletion(); break; default: smart_xoops_cp_header(); smart_adminMenu(5, _AM_SOBJECT_CURRENCIES); smart_collapsableBar('createdcurrencies', _AM_SOBJECT_CURRENCIES, _AM_SOBJECT_CURRENCIES_DSC); include_once SMARTOBJECT_ROOT_PATH . "class/smartobjecttable.php"; $objectTable = new SmartObjectTable($smartobject_currency_handler); $objectTable->addColumn(new SmartObjectColumn('name', 'left', false, 'getCurrencyLink')); $objectTable->addColumn(new SmartObjectColumn('rate', 'center', 150)); $objectTable->addColumn(new SmartObjectColumn('iso4217', 'center', 150)); $objectTable->addColumn(new SmartObjectColumn('default_currency', 'center', 150, 'getDefault_currencyControl')); $objectTable->addIntroButton('addcurrency', 'currency.php?op=mod', _AM_SOBJECT_CURRENCIES_CREATE); $objectTable->addActionButton('updateCurrencies', _SUBMIT, _AM_SOBJECT_CURRENCY_UPDATE_ALL); $objectTable->render();
function getPrintAndMailLink() { $controller = new SmartObjectController($this->handler); return $controller->getPrintAndMailLink($this); }
require_once SMARTOBJECT_ROOT_PATH . 'class/smartloader.php'; require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectlink.php'; require_once XOOPS_ROOT_PATH . '/class/template.php'; $xoopsTpl = new XoopsTpl(); $myts =& MyTextSanitizer::getInstance(); $xoopsConfig['sitename'] = $myts->displayTarea($xoopsConfig['sitename']); xoops_header(false); echo smart_get_css_link(SMARTOBJECT_URL . 'module.css'); echo '</head><body>'; $smartobject_link_handler = xoops_getmodulehandler('link', 'smartobject'); $linkObj = $smartobject_link_handler->create(); $op = isset($_POST['op']) ? $_POST['op'] : ''; switch ($op) { case 'sendlink': include_once XOOPS_ROOT_PATH . "/modules/smartobject/class/smartobjectcontroller.php"; $controller = new SmartObjectController($smartobject_link_handler); $linkObj = $controller->storeSmartObject(); if ($linkObj->hasError()) { /** * @todo inform user and propose to close the window if a problem occured when saving the link */ } $xoopsMailer =& getMailer(); $xoopsMailer->useMail(); $xoopsMailer->setTemplateDir('language/' . $xoopsConfig['language'] . '/mail_template'); $xoopsMailer->setTemplate('sendlink.tpl'); $xoopsMailer->assign('X_SITENAME', $xoopsConfig['sitename']); $xoopsMailer->assign('TO_NAME', $linkObj->getVar('to_name')); $xoopsMailer->assign('FROM_NAME', $linkObj->getVar('from_name')); $xoopsMailer->assign('SITEURL', XOOPS_URL . "/"); $xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
function createTableRows() { $this->_aObjects = array(); $doWeHaveActions = false; $objectclass = 'odd'; if (count($this->_objects) > 0) { foreach ($this->_objects as $object) { $aObject = array(); $i = 0; $aColumns = array(); foreach ($this->_columns as $column) { $aColumn = array(); if ($i == 0) { $class = "head"; } elseif ($i % 2 == 0) { $class = "even"; } else { $class = "odd"; } if (method_exists($object, 'initiateCustomFields')) { //$object->initiateCustomFields(); } if ($column->_keyname == 'checked') { $value = '<input type ="checkbox" name="selected_smartobjects[]" value="' . $object->id() . '" />'; } elseif ($column->_customMethodForValue && method_exists($object, $column->_customMethodForValue)) { $method = $column->_customMethodForValue; if ($column->_param) { $value = $object->{$method}($column->_param); } else { $value = $object->{$method}(); } } else { /** * If the column is the identifier, then put a link on it */ if ($column->getKeyName() == $this->_objectHandler->identifierName) { $value = $object->getItemLink(); } else { $value = $object->getVar($column->getKeyName()); } } $aColumn['value'] = $value; $aColumn['class'] = $class; $aColumn['width'] = $column->getWidth(); $aColumn['align'] = $column->getAlign(); $aColumns[] = $aColumn; $i++; } $aObject['columns'] = $aColumns; $aObject['id'] = $object->id(); $objectclass = $objectclass == 'even' ? 'odd' : 'even'; $aObject['class'] = $objectclass; $actions = array(); // Adding the custom actions if any foreach ($this->_custom_actions as $action) { if (method_exists($object, $action)) { $actions[] = $object->{$action}(); } } include_once SMARTOBJECT_ROOT_PATH . "class/smartobjectcontroller.php"; $controller = new SmartObjectController($this->_objectHandler); if (!is_array($this->_actions) || in_array('edit', $this->_actions)) { $actions[] = $controller->getEditItemLink($object, false, true, $this->_userSide); } if (!is_array($this->_actions) || in_array('delete', $this->_actions)) { $actions[] = $controller->getDeleteItemLink($object, false, true, $this->_userSide); } $aObject['actions'] = $actions; $this->_tpl->assign('smartobject_actions_column_width', count($actions) * 30); $doWeHaveActions = $doWeHaveActions ? true : count($actions) > 0; $this->_aObjects[] = $aObject; } $this->_tpl->assign('smartobject_objects', $this->_aObjects); } else { $colspan = count($this->_columns) + 1; $this->_tpl->assign('smartobject_colspan', $colspan); } $this->_hasActions = $doWeHaveActions; }
*/ include_once "admin_header.php"; include_once SMARTOBJECT_ROOT_PATH . "class/smartobjecttable.php"; include_once SMARTOBJECT_ROOT_PATH . "class/smartobjectlink.php"; $smartobject_link_handler = xoops_getmodulehandler('link'); $op = ''; if (isset($_GET['op'])) { $op = $_GET['op']; } if (isset($_POST['op'])) { $op = $_POST['op']; } switch ($op) { case "del": include_once XOOPS_ROOT_PATH . "/modules/smartobject/class/smartobjectcontroller.php"; $controller = new SmartObjectController($smartobject_link_handler); $controller->handleObjectDeletion(_AM_SOBJECT_SENT_LINK_DELETE_CONFIRM); break; case "view": $linkid = isset($_GET['linkid']) ? $_GET['linkid'] : 0; $linkObj = $smartobject_link_handler->get($linkid); if ($linkObj->isNew()) { redirect_header(SMARTOBJECT_URL . "admin/link.php", 3, _AM_SOBJECT_LINK_NOT_FOUND); } smart_xoops_cp_header(); smart_adminMenu(1, _AM_SOBJECT_SENT_LINK_DISPLAY); smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINK_DISPLAY, _AM_SOBJECT_SENT_LINK_DISPLAY_INFO); include_once XOOPS_ROOT_PATH . '/class/template.php'; $xoopsTpl =& new XoopsTpl(); $xoopsTpl->assign('link', $linkObj->toArray()); $xoopsTpl->display('db:smartobject_sentlink_display.html');
function getEditLanguageLink($onlyUrl = false, $withimage = true) { $controller = new SmartObjectController($this->handler); return $controller->getEditLanguageLink($this, $onlyUrl, $withimage); }