Example #1
1
 /**
  * Create a new sqlite connector
  *
  * @param array
  */
 public function __construct($config)
 {
     extract($config);
     $dns = 'sqlite:' . $database;
     $this->pdo = new PDO($dns);
     $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
 }
/**
 * Newscoop list_community_feeds block plugin
 *
 * Type:     block
 * Name:     community_feeds
 *
 * @param array $params
 * @param mixed $content
 * @param object $smarty
 * @param bool $repeat
 * @return string
 */
function smarty_block_list_community_feeds($params, $content, &$smarty, &$repeat)
{
    $context = $smarty->getTemplateVars('gimme');
    if (!isset($content)) {
        // init
        $start = $context->next_list_start('CommunityFeed');
        $list = new CommunityFeedsList($start, $params);
        if ($list->isEmpty()) {
            $context->setCurrentList($list, array());
            $context->resetCurrentList();
            $repeat = false;
            return;
        }
        $context->setCurrentList($list, array('community_feeds'));
        $context->community_feed = $context->current_community_feeds_list->current;
        $repeat = true;
    } else {
        // next
        $context->current_community_feeds_list->defaultIterator()->next();
        if (!is_null($context->current_community_feeds_list->current)) {
            $context->community_feed = $context->current_community_feeds_list->current;
            $repeat = true;
        } else {
            $context->resetCurrentList();
            $repeat = false;
        }
    }
    return $content;
}
Example #3
1
/**
 * Campsite url function plugin
 *
 * Type:     function
 * Name:     url
 * Purpose:
 *
 * @param array $p_params
 * @param object $p_smarty
 *      The Smarty object
 *
 * @return string $urlString
 *      The full URL string
 */
function smarty_function_url($p_params, &$p_smarty)
{
    $context = $p_smarty->getTemplateVars('gimme');
    $validValues = array('true', 'false', 'http', 'https');
    if (isset($p_params['useprotocol']) && in_array($p_params['useprotocol'], $validValues)) {
        $useprotocol = $p_params['useprotocol'];
    } else {
        $useprotocol = $p_smarty->useprotocol;
    }
    switch ($useprotocol) {
        case 'true':
            $urlString = $context->url->base;
            break;
        case 'false':
            $urlString = $context->url->base_relative;
            break;
        case 'http':
            $urlString = 'http:' . $context->url->base_relative;
            break;
        case 'https':
            $urlString = 'https:' . $context->url->base_relative;
            break;
    }
    // appends the URI path and query values to the base
    $urlString .= smarty_function_uri($p_params, $p_smarty);
    return $urlString;
}
Example #4
1
 /**
  * Получить окружение ядака
  * @return  object 
  */
 public static final function env()
 {
     if (empty(self::$g4)) {
         self::start();
     }
     return self::$g4->decode(self::$g4);
 }
Example #5
0
 /**
  * @param object $command Pheanstalk_Command
  * @return object Pheanstalk_Response
  * @throws Pheanstalk_Exception_ClientException
  */
 public function dispatchCommand($command)
 {
     $socket = $this->_getSocket();
     $to_send = $command->getCommandLine() . self::CRLF;
     if ($command->hasData()) {
         $to_send .= $command->getData() . self::CRLF;
     }
     $socket->write($to_send);
     $responseLine = $socket->getLine();
     $responseName = preg_replace('#^(\\S+).*$#s', '$1', $responseLine);
     if (isset(self::$_errorResponses[$responseName])) {
         $exception = sprintf('Pheanstalk_Exception_Server%sException', self::$_errorResponses[$responseName]);
         throw new $exception(sprintf("%s in response to '%s'", $responseName, $command));
     }
     if (in_array($responseName, self::$_dataResponses)) {
         $dataLength = preg_replace('#^.*\\b(\\d+)$#', '$1', $responseLine);
         $data = $socket->read($dataLength);
         $crlf = $socket->read(self::CRLF_LENGTH);
         if ($crlf !== self::CRLF) {
             throw new Pheanstalk_Exception_ClientException(sprintf('Expected %u bytes of CRLF after %u bytes of data', self::CRLF_LENGTH, $dataLength));
         }
     } else {
         $data = null;
     }
     return $command->getResponseParser()->parseResponse($responseLine, $data);
 }
/**
 * Smarty function to display the category menu for admin links. This also adds the
 * navtabs.css to the page vars array for stylesheets.
 *
 * Admin
 * {admincategorymenu}
 *
 * @see          function.admincategorymenu.php::smarty_function_admincategoreymenu()
 * @param        array       $params      All attributes passed to this function from the template
 * @param        object      $view        Reference to the Zikula_View object
 * @return       string      the results of the module function
 */
function smarty_function_admincategorymenu($params, $view)
{
    PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet('Admin'));
    $modinfo = ModUtil::getInfoFromName($view->getTplVar('toplevelmodule'));
    $acid = ModUtil::apiFunc('AdminModule', 'admin', 'getmodcategory', array('mid' => $modinfo['id']));
    return ModUtil::func('AdminModule', 'admin', 'categorymenu', array('acid' => $acid));
}
Example #7
0
 /**
  * Helper function
  *
  * @param  object $module
  * @param  object $element
  * @param  integer $level
  */
 protected static function _process($module, $element, $level = 0)
 {
     global $warp;
     if ($level == 0) {
         $element->attr('class', 'uk-subnav');
     } else {
         $element->addClass('level' . ($level + 1));
     }
     foreach ($element->children('li') as $li) {
         // is active ?
         if ($active = $li->attr('data-menu-active')) {
             $active = ' uk-active';
         }
         // is parent ?
         $ul = $li->children('ul');
         $parent = $ul->length ? ' uk-parent' : null;
         // set class in li
         $li->attr('class', sprintf('level%d' . $parent . $active, $level + 1, $li->attr('data-id')));
         // set class in a/span
         foreach ($li->children('a,span') as $child) {
             // set image
             if ($image = $li->attr('data-menu-image')) {
                 $child->prepend('<img src="' . $image . '" alt="' . $child->text() . '" /> ');
             }
             // set icon
             if ($icon = $li->attr('data-menu-icon')) {
                 $child->prepend('<i class="' . $icon . '"></i> ');
             }
         }
         // process submenu
         if ($ul->length) {
             self::_process($module, $ul->item(0), $level + 1);
         }
     }
 }
Example #8
0
 /**
  * Get term with given slug(s)
  *
  * @param object       $query The query object
  * @param array|string $slug  The name(s) of the slug(s)
  *
  * @return object The query object
  */
 public function scopeSlug($query, $slug)
 {
     if (!is_array($slug)) {
         return $query->where('slug', $slug);
     }
     return $query->whereIn('slug', $slug);
 }
Example #9
0
 /**
  * Display an edit icon for the article.
  *
  * This icon will not display in a popup window, nor if the article is trashed.
  * Edit access checks must be performed in the calling code.
  *
  * @param	object	$article	The article in question.
  * @param	object	$params		The article parameters
  * @param	array	$attribs	Not used??
  *
  * @return	string	The HTML for the article edit icon.
  * @since	1.6
  */
 static function edit($article, $params, $attribs = array())
 {
     // Initialise variables.
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $uri = JFactory::getURI();
     // Ignore if in a popup window.
     if ($params && $params->get('popup')) {
         return;
     }
     // Ignore if the state is negative (trashed).
     if ($article->state < 0) {
         return;
     }
     JHtml::_('behavior.tooltip');
     $url = 'index.php?task=article.edit&a_id=' . $article->id . '&return=' . base64_encode($uri);
     $icon = $article->state ? 'edit.png' : 'edit_unpublished.png';
     $text = JHTML::_('image', 'system/' . $icon, JText::_('JGLOBAL_EDIT'), NULL, true);
     if ($article->state == 0) {
         $overlib = JText::_('JUNPUBLISHED');
     } else {
         $overlib = JText::_('JPUBLISHED');
     }
     $date = JHTML::_('date', $article->created);
     $author = $article->created_by_alias ? $article->created_by_alias : $article->author;
     $overlib .= '&lt;br /&gt;';
     $overlib .= $date;
     $overlib .= '&lt;br /&gt;';
     $overlib .= JText::sprintf('COM_CONTENT_WRITTEN_BY', htmlspecialchars($author, ENT_COMPAT, 'UTF-8'));
     $button = JHTML::_('link', JRoute::_($url), $text);
     $output = '<span class="hasTip" title="' . JText::_('COM_CONTENT_EDIT_ITEM') . ' :: ' . $overlib . '">' . $button . '</span>';
     return $output;
 }
Example #10
0
 /**
  * Helper function for testIssue16078(), based on ezpObject::addTranslation().
  *
  * @param object $object
  * @param string $newLanguageCode
  * @return version in new language
  */
 public function addTranslationDontPublish($object, $newLanguageCode)
 {
     // Make sure to refresh the objects data.
     $object->refresh();
     $object->object->cleanupInternalDrafts();
     $publishedDataMap = $object->object->dataMap();
     $version = $object->object->createNewVersionIn($newLanguageCode, 'eng-GB');
     // Create new translation based on eng-GB
     $version->setAttribute('status', eZContentObjectVersion::STATUS_INTERNAL_DRAFT);
     $version->store();
     $newVersion = $object->object->version($version->attribute('version'));
     $newVersionAttributes = $newVersion->contentObjectAttributes($newLanguageCode);
     $versionDataMap = array();
     foreach ($newVersionAttributes as $attribute) {
         $versionDataMap[$attribute->contentClassAttributeIdentifier()] = $attribute;
     }
     // Start updating new version
     $version->setAttribute('modified', time());
     $version->setAttribute('status', eZContentObjectVersion::STATUS_DRAFT);
     $db = eZDB::instance();
     $db->begin();
     $version->store();
     foreach ($publishedDataMap as $attr => $value) {
         $versionDataMap[$attr]->setAttribute('data_text', $value->attribute('data_text'));
         $versionDataMap[$attr]->store();
     }
     $db->commit();
     return $version;
 }
 /**
  * Устанавливает панель инструментов.
  *
  * @return  void
  */
 protected function addToolBar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $isNew = $this->item->id == 0;
     JToolBarHelper::title($isNew ? JText::_('COM_HELLOWORLD_MANAGER_HELLOWORLD_NEW') : JText::_('COM_HELLOWORLD_MANAGER_HELLOWORLD_EDIT'), 'helloworld');
     // Устанавливаем действия для новых и существующих записей.
     if ($isNew) {
         // Для новых записей проверяем право создания.
         if ($this->canDo->get('core.create')) {
             JToolBarHelper::apply('helloworld.apply', 'JTOOLBAR_APPLY');
             JToolBarHelper::save('helloworld.save', 'JTOOLBAR_SAVE');
             JToolBarHelper::custom('helloworld.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
         }
         JToolBarHelper::cancel('helloworld.cancel', 'JTOOLBAR_CANCEL');
     } else {
         // Для существующих записей проверяем право редактирования.
         if ($this->canDo->get('core.edit')) {
             // Мы можем сохранять новую запись.
             JToolBarHelper::apply('helloworld.apply', 'JTOOLBAR_APPLY');
             JToolBarHelper::save('helloworld.save', 'JTOOLBAR_SAVE');
             // Мы можем сохранять  в новую запись, но нужна проверка на создание.
             if ($this->canDo->get('core.create')) {
                 JToolBarHelper::custom('helloworld.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
             }
         }
         // Для сохранения копии записи проверяем право создания.
         if ($this->canDo->get('core.create')) {
             JToolBarHelper::custom('helloworld.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
         }
         JToolBarHelper::cancel('helloworld.cancel', $isNew ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE');
     }
 }
Example #12
0
 /**
  * Get all contributors of all resources
  *
  * @return  array
  */
 public function getCons()
 {
     // get all eligible resource contributors
     $sql = "SELECT DISTINCT aa.authorid, SUM(r.ranking) as ranking FROM #__author_assoc AS aa " . " LEFT JOIN #__resources AS r ON r.id=aa.subid " . " WHERE aa.authorid > 0 AND r.published=1 AND r.standalone=1 GROUP BY aa.authorid ";
     $this->_db->setQuery($sql);
     return $this->_db->loadObjectList();
 }
Example #13
0
 /**
  * Get form instance
  *
  * @return object
  */
 public function getForm()
 {
     // get form builder
     if (!$this->form) {
         // add extra options for the title
         $this->formElements['title']['description_params'] = [$this->widgetDescription];
         // add extra options for the cache ttl
         if ($this->showCacheSettings) {
             $this->formElements['cache_ttl']['description_params'] = [(int) SettingService::getSetting('application_dynamic_cache_life_time')];
             // add extra validators
             $this->formElements['cache_ttl']['validators'] = [['name' => 'callback', 'options' => ['callback' => [$this, 'validateCacheTtl'], 'message' => 'Enter a correct value']]];
         } else {
             unset($this->formElements['cache_ttl']);
         }
         // add extra options for the visibility settings
         if ($this->showVisibilitySettings) {
             // add visibility settings
             $this->formElements['visibility_settings']['values'] = AclService::getAclRoles(false, true);
         } else {
             unset($this->formElements['visibility_settings']);
         }
         // fill the form with default values
         $this->formElements['layout']['values'] = $this->model->getWidgetLayouts();
         $this->form = new ApplicationCustomFormBuilder($this->formName, $this->formElements, $this->translator, $this->ignoredElements, $this->notValidatedElements, $this->method);
     }
     return $this->form;
 }
 /**
  * Parse template.
  *
  * @param string $moduleName    module name
  * @param string $methodName    method name
  * @access public
  * @return string
  */
 public function parse($moduleName, $methodName)
 {
     /* Register app, config, lang objects. */
     global $app, $config, $lang;
     $this->smarty->register_object('control', $this->control);
     $this->smarty->register_object('app', $app);
     $this->smarty->register_object('lang', $lang);
     $this->smarty->register_object('config', $config);
     /* Get view files from control. */
     $viewFile = $this->control->setViewFile($moduleName, $methodName);
     echo $viewFile;
     if (is_array($viewFile)) {
         extract($viewFile);
     }
     /* Assign hook files. */
     if (!isset($hookFiles)) {
         $hookFiles = array();
     }
     $this->smarty->assign('hookFiles', $hookFiles);
     /* Assign view variables. */
     foreach ($this->control->view as $item => $value) {
         $this->smarty->assign($item, $value);
     }
     /* Render the template and return it. */
     $output = $this->smarty->fetch($viewFile);
     echo $output;
     return $output;
 }
Example #15
0
File: file.php Project: rikaix/core
 /**
  * Run the controller and parse the template
  */
 public function run()
 {
     $this->Template = new BackendTemplate('be_picker');
     $this->Template->main = '';
     // Ajax request
     if ($_POST && Environment::get('isAjaxRequest')) {
         $this->objAjax = new Ajax(Input::post('action'));
         $this->objAjax->executePreActions();
     }
     $strTable = Input::get('table');
     $strField = Input::get('field');
     $this->loadDataContainer($strTable);
     $objDca = new DC_Table($strTable);
     // AJAX request
     if ($_POST && Environment::get('isAjaxRequest')) {
         $this->objAjax->executePostActions($objDca);
     }
     $objFileTree = new $GLOBALS['BE_FFL']['fileSelector'](array('strId' => $strField, 'strTable' => $strTable, 'strField' => $strField, 'strName' => $strField, 'varValue' => explode(',', Input::get('value'))), $objDca);
     $this->Template->main = $objFileTree->generate();
     $this->Template->theme = $this->getTheme();
     $this->Template->base = Environment::get('base');
     $this->Template->language = $GLOBALS['TL_LANGUAGE'];
     $this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['filepicker']);
     $this->Template->headline = $GLOBALS['TL_LANG']['MSC']['ppHeadline'];
     $this->Template->charset = $GLOBALS['TL_CONFIG']['characterSet'];
     $this->Template->options = $this->createPageList();
     $this->Template->expandNode = $GLOBALS['TL_LANG']['MSC']['expandNode'];
     $this->Template->collapseNode = $GLOBALS['TL_LANG']['MSC']['collapseNode'];
     $this->Template->loadingData = $GLOBALS['TL_LANG']['MSC']['loadingData'];
     $this->Template->search = $GLOBALS['TL_LANG']['MSC']['search'];
     $this->Template->action = ampersand(Environment::get('request'));
     $this->Template->value = $this->Session->get('file_selector_search');
     $GLOBALS['TL_CONFIG']['debugMode'] = false;
     $this->Template->output();
 }
Example #16
0
 /**
  * @param int|null|string $name
  * @param object $data
  */
 public function __construct($name, $data, $options)
 {
     parent::__construct($name);
     $pspList = $options->get('pspList');
     $pspArray = ['' => '-- Choose PSP --'];
     if ($pspList && $pspList->count()) {
         foreach ($pspList as $psp) {
             $pspArray[$psp->getId()] = $psp->getShortName();
         }
     }
     $this->setName($name);
     $name_attr = array('type' => 'text', 'class' => 'form-control', 'id' => 'name', 'maxlength' => 150, 'value' => $data->getName());
     $conciergeEmailAttr = ['type' => 'text', 'class' => 'form-control', 'id' => 'concierge_email', 'maxlength' => 255];
     $this->add(['name' => 'concierge_email', 'attributes' => $conciergeEmailAttr]);
     $this->add(array('name' => 'name', 'attributes' => $name_attr));
     $buttons_save = 'Save Changes';
     $this->add(array('name' => 'save_button', 'options' => array('label' => $buttons_save), 'attributes' => array('type' => 'button', 'class' => 'btn btn-primary state col-sm-2 col-xs-12 margin-left-10 pull-right', 'data-loading-text' => 'Saving...', 'id' => 'save_button', 'value' => 'Save')));
     $this->add(['name' => 'psp_id', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['label' => 'PSP', 'value_options' => $pspArray], 'attributes' => ['class' => 'form-control', 'id' => 'psp-id']]);
     if (is_object($data)) {
         $objectData = new \ArrayObject();
         $objectData['concierge_email'] = $data->getEmail();
         $objectData['psp_id'] = $data->getPspId();
         $this->bind($objectData);
     }
 }
Example #17
0
 /**
  * Constructor
  * @param	object    $object   reference to targetobject (@link icms_ipf_Object)
  * @param	string    $key      the form name
  */
 public function __construct($object, $key)
 {
     icms_loadLanguageFile('system', 'blocksadmin', TRUE);
     parent::__construct(_AM_VISIBLEIN, ' ', $key . '_visiblein_tray');
     $visible_label = new icms_form_elements_Label('', '<select name="visiblein[]" id="visiblein[]" multiple="multiple" size="10">' . $this->getPageSelOptions($object->getVar('visiblein')) . '</select>');
     $this->addElement($visible_label);
 }
 function display()
 {
     $templateMgr = TemplateManager::getManager();
     $templateMgr->assign('depositPointId', $this->depositPointId);
     $templateMgr->assign('depositPointTypes', $this->plugin->getTypeMap());
     parent::display();
 }
 /**
  * Query the existing transaction codes with the id of the request and assembles an array with these codes.
  * @param object $observer - It is an object of Event of observe.
  */
 public function salesOrderGridCollectionLoadBefore($observer)
 {
     $collection = $observer->getOrderGridCollection();
     $select = $collection->getSelect();
     $tableCollection = Mage::getSingleton('core/resource')->getTableName('pagseguro_orders');
     $select->joinLeft(array('payment' => $tableCollection), 'payment.order_id = main_table.entity_id', array('payment_code' => 'transaction_code', 'payment_environment' => 'environment'));
 }
Example #20
0
 /**
  * This method determines what should be done with a given file and adds
  * it via {@link GroupTest::addTestFile()} if necessary.
  *
  * This method should be overriden to provide custom matching criteria,
  * such as pattern matching, recursive matching, etc.  For an example, see
  * {@link SimplePatternCollector::_handle()}.
  *
  * @param object $test      Group test with {@link GroupTest::addTestFile()} method.
  * @param string $filename  A filename as generated by {@link collect()}
  * @see collect()
  * @access protected
  */
 protected function handle(&$test, $file)
 {
     if (is_dir($file)) {
         return;
     }
     $test->addFile($file);
 }
 /**
  *  Check if the Group have access to the aco
  *
  * @param \App\Model\Entity\Group $aro The Aro of the group you want to check
  * @param string                  $aco The path of the Aco like App/Blog/add
  *
  * @return bool
  */
 public function checkGroup($aro, $aco = null)
 {
     if (empty($aro) || empty($aco)) {
         return false;
     }
     return $this->Acl->check($aro, $aco);
 }
 /**
  * Fetch and mix all the posts
  * @return array The mixed and sorted posts
  */
 public function fetch()
 {
     $this->facebook->fetch();
     $this->twitter->fetch();
     $this->posts->fetch();
     return $this->merge()->sort()->merged;
 }
 /**
  * Transforms an object (object) to a string (id).
  *
  * @param object|null $object
  *
  * @return string
  */
 public function transform($object)
 {
     if (null === $object) {
         return '';
     }
     return $object->getId();
 }
Example #24
0
 /**
  * Stub a chain of methods.
  *
  * @param  string $expected the method to be stubbed or a chain of methods.
  * @return        self.
  */
 public function toReceive()
 {
     if (!$this->_isClass) {
         throw new Exception("Error `toReceive()` are only available on classes/instances not functions.");
     }
     return $this->_method = $this->_stub->method(func_get_args());
 }
 /**
  * Reads extension metadata
  *
  * @param object $meta
  * @return array - the metatada configuration
  */
 public function getExtensionMetadata($meta)
 {
     if ($meta->isMappedSuperclass) {
         return;
         // ignore mappedSuperclasses for now
     }
     $config = array();
     $cmf = $this->objectManager->getMetadataFactory();
     $useObjectName = $meta->name;
     // collect metadata from inherited classes
     if (null !== $meta->reflClass) {
         foreach (array_reverse(class_parents($meta->name)) as $parentClass) {
             // read only inherited mapped classes
             if ($cmf->hasMetadataFor($parentClass)) {
                 $class = $this->objectManager->getClassMetadata($parentClass);
                 $this->driver->readExtendedMetadata($class, $config);
                 $isBaseInheritanceLevel = !$class->isInheritanceTypeNone() && !$class->parentClasses && $config;
                 if ($isBaseInheritanceLevel) {
                     $useObjectName = $class->name;
                 }
             }
         }
     }
     $this->driver->readExtendedMetadata($meta, $config);
     if ($config) {
         $config['useObjectClass'] = $useObjectName;
     }
     // cache the metadata (even if it's empty)
     // caching empty metadata will prevent re-parsing non-existent annotations
     $cacheId = self::getCacheId($meta->name, $this->extensionNamespace);
     if ($cacheDriver = $cmf->getCacheDriver()) {
         $cacheDriver->save($cacheId, $config, null);
     }
     return $config;
 }
Example #26
0
/**
 * Smarty block function providing gettext support
 *
 * See CRM_Core_I18n class documentation for details.
 *
 * @param array $params   template call's parameters
 * @param string $text    {ts} block contents from the template
 * @param object $smarty  the Smarty object
 *
 * @return string  the string, translated by gettext
 */
function smarty_block_ts($params, $text, &$smarty)
{
    if (!isset($params['domain'])) {
        $params['domain'] = $smarty->get_template_vars('extensionKey');
    }
    return ts($text, $params);
}
Example #27
0
 /**
  * Used to bulk load functionality into twig engine
  *
  * @return void
  * @author Dan Cox
  */
 private function addFunctionality()
 {
     $this->twig->addFunction($this->_function_App());
     $this->twig->addFunction($this->_function_Route());
     $this->twig->addFunction($this->_function_Input());
     $this->twig->addFunction($this->_function_CurrentRoute());
 }
 /**
  * Constructor
  *
  * @param object  $a_parent_obj
  * @param string  $a_parent_cmd
  * @param integer $a_ref_id
  */
 public function __construct($a_parent_obj, $a_parent_cmd, $a_ref_id)
 {
     global $ilCtrl, $lng, $rssPermission;
     $this->permission = $rssPermission;
     $this->lng = $lng;
     $this->ctrl = $ilCtrl;
     $this->pl = ilRoomSharingPlugin::getInstance();
     $this->parent_obj = $a_parent_obj;
     $this->ref_id = $a_ref_id;
     $this->setId("roomobj");
     $this->bookings = new ilRoomSharingBookings($a_parent_obj->getPoolId());
     $this->bookings->setPoolId($a_parent_obj->getPoolId());
     parent::__construct($a_parent_obj, $a_parent_cmd);
     $this->setTitle($this->lng->txt("rep_robj_xrs_bookings"));
     $this->setLimit(10);
     // data sets per page
     $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
     // add columns and column headings
     $this->addColumns();
     // checkboxes labeled with "bookings" get affected by the "Select All"-Checkbox
     $this->setSelectAllCheckbox('bookings');
     $this->setRowTemplate("tpl.room_appointment_row.html", "Customizing/global/plugins/Services/Repository/RepositoryObject/RoomSharing/");
     // command for cancelling bookings
     if ($this->permission->checkPrivilege(PRIVC::ADD_OWN_BOOKINGS) || $this->permission->checkPrivilege(PRIVC::CANCEL_BOOKING_LOWER_PRIORITY)) {
         $this->addMultiCommand('confirmMultipleCancels', $this->lng->txt('rep_robj_xrs_booking_cancel'));
     }
 }
Example #29
0
 /**
  * Method to get shipping rates from the USPS
  *
  * @param string $element
  * @param object $order
  * @return an array of shopping rates
  */
 function onJ2StoreGetShippingRates($element, $order)
 {
     $rates = array();
     //initialise system variables
     $app = JFactory::getApplication();
     $db = JFactory::getDbo();
     // Check if this is the right plugin
     if (!$this->_isMe($element)) {
         return $rates;
     }
     //set the address
     $order->setAddress();
     //get the shipping address
     $address = $order->getShippingAddress();
     $geozone_id = $this->params->get('usps_geozone', 0);
     //get the geozones
     $query = $db->getQuery(true);
     $query->select('gz.*,gzr.*')->from('#__j2store_geozones AS gz')->leftJoin('#__j2store_geozonerules AS gzr ON gzr.geozone_id = gz.geozone_id')->where('gz.geozone_id=' . $geozone_id)->where('gzr.country_id=' . $db->q($address['country_id']) . ' AND (gzr.zone_id=0 OR gzr.zone_id=' . $db->q($address['zone_id']) . ')');
     $db->setQuery($query);
     $grows = $db->loadObjectList();
     if (!$geozone_id) {
         $status = true;
     } elseif ($grows) {
         $status = true;
     } else {
         $status = false;
     }
     if ($status) {
         $rates = $this->getRates($address);
     }
     //print_r($rates);
     return $rates;
 }
 /**
  * Method to get a specific wiki page in HTML
  *
  * @param string $pagename
  * @return string HTML
  */
 public function fullGraph()
 {
     $msg = new XML_RPC_Message('dlGraphFull');
     $pserv = $this->objSysConfig->getValue('package_server', 'packages');
     $purl = $this->objSysConfig->getValue('package_url', 'packages');
     $cli = new XML_RPC_Client($purl, $pserv);
     $cli->setDebug(0);
     // send the request message
     $resp = $cli->send($msg);
     if (!$resp) {
         throw new customException($this->objLanguage->languageText("mod_filters_commserr", "filters") . ": " . $cli->errstr);
         exit;
     }
     if (!$resp->faultCode()) {
         $val = $resp->value();
         $val = XML_RPC_decode($val);
         if (is_array($val)) {
             return $val['faultString'];
         } else {
             return $val;
         }
     } else {
         /*
          * Display problems that have been gracefully caught and
          * reported by the xmlrpc server class.
          */
         throw new customException($this->objLanguage->languageText("mod_filters_faultcode", "filters") . ": " . $resp->faultCode() . $this->objLanguage->languageText("mod_filters_faultreason", "filters") . ": " . $resp->faultString());
     }
 }