Exemple #1
0
 /**
  * Method to delete a row from the database table by primary key value.
  *
  * @param	mixed	An optional primary key value to delete.  If not set the
  *					instance property value is used.
  * @return	boolean	True on success.
  * @since	1.0
  * @link	http://docs.joomla.org/JTable/delete
  */
 public function delete($pk = null)
 {
     $query = $this->_db->getQuery(true);
     // Delete all rooms belong to it
     JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_solidres/models', 'SolidresModel');
     $query->clear();
     $query->select('*')->from($this->_db->quoteName('#__sr_rooms'))->where('room_type_id = ' . $this->_db->quote($pk));
     $rooms = $this->_db->setQuery($query)->loadObjectList();
     $roomModel = JModelLegacy::getInstance('Room', 'SolidresModel');
     foreach ($rooms as $room) {
         $roomModel->delete($room->id);
     }
     // Delete all coupons relation
     $query->clear();
     $query->delete($this->_db->quoteName('#__sr_room_type_coupon_xref'))->where('room_type_id = ' . $this->_db->quote($pk));
     $this->_db->setQuery($query)->execute();
     // Delete all extras relation
     $query->clear();
     $query->delete($this->_db->quoteName('#__sr_room_type_extra_xref'))->where('room_type_id = ' . $this->_db->quote($pk));
     $this->_db->setQuery($query)->execute();
     // Delete all custom fields
     $query->clear();
     $query->delete($this->_db->quoteName('#__sr_room_type_fields'))->where('room_type_id = ' . $this->_db->quote($pk));
     $this->_db->setQuery($query)->execute();
     // Delete all media
     $query->clear();
     $query->delete($this->_db->quoteName('#__sr_media_roomtype_xref'))->where('room_type_id = ' . $this->_db->quote($pk));
     $this->_db->setQuery($query)->execute();
     // Delete all prices
     $query->clear();
     $query->delete($this->_db->quoteName('#__sr_prices'))->where('room_type_id = ' . $this->_db->quote($pk));
     $this->_db->setQuery($query)->execute();
     // Delete itself
     return parent::delete($pk);
 }
Exemple #2
0
 /**
  * Method to delete a row from the database table by primary key value.
  *
  * @param   mixed    $pk  An optional primary key value to delete.  If not set the
  *                        instance property value is used.
  *
  * @return  boolean  True on success.
  * @since   0.3.0
  */
 public function delete($pk = null)
 {
     $k = $this->_tbl_key;
     $pk = is_null($pk) ? $this->{$k} : $pk;
     $query = $this->_db->getQuery(true);
     JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_solidres/models', 'UsersModel');
     // Take care of Customer records
     $query->select('COUNT(id)')->from($this->_db->quoteName('#__sr_customers'))->where('customer_group_id = ' . $pk);
     $this->_db->setQuery($query);
     $result = (int) $this->_db->loadResult();
     if ($result > 0) {
         $e = new JException(JText::sprintf('SR_ERROR_CUSTOMER_GROUP_CONTAINS_CUSTOMER', $this->name));
         $this->setError($e);
         return false;
     }
     // Delete all prices
     $query->clear();
     $query->delete($this->_db->quoteName('#__sr_prices'))->where('customer_group_id = ' . $this->_db->quote($pk));
     $this->_db->setQuery($query)->execute();
     // Take care of Coupon
     $couponsModel = JModelLegacy::getInstance('Coupons', 'SolidresModel', array('ignore_request' => true));
     $couponModel = JModelLegacy::getInstance('Coupon', 'SolidresModel', array('ignore_request' => true));
     $couponsModel->setState('filter.customer_group_id', $pk);
     $coupons = $couponsModel->getItems();
     foreach ($coupons as $coupon) {
         $couponModel->delete($coupon->id);
     }
     // Delete it
     return parent::delete($pk);
 }
 public function getCalendar()
 {
     $data = new stdClass();
     $pairId = JRequest::getInt('id');
     $monday = JRequest::getInt('monday', strtotime('monday this week'));
     $pair =& JTable::getInstance('pairslanguage', 'VideoTranslationTable');
     $pair->load($pairId);
     $language =& JTable::getInstance('language', 'VideoTranslationTable');
     $language->load($pair->langId1);
     $data->language1 = $language->name;
     $language->load($pair->langId2);
     $data->language2 = $language->name;
     $data->monday = date("F j", $monday);
     $data->sunday = date("F j, Y", $monday + 6 * 24 * 60 * 60);
     JModelLegacy::addIncludePath(JPATH_ROOT . '/components/com_videotranslation/models', 'VideoTranslationModel');
     $frontpage = JModelLegacy::getInstance('frontpage', 'VideoTranslationModel', array('ignore_request' => true));
     $this->populateState();
     $filter_interpreter = $this->getState('filter.interpreter_id');
     for ($i = 0; $i < 7; $i++) {
         $data->weekdays[] = date("l", $monday + $i * 24 * 60 * 60);
         //list items
         $data->rows[date("l", $monday + $i * 24 * 60 * 60)] = $frontpage->getItemsForThisDay($monday + $i * 24 * 60 * 60, $monday + $i * 24 * 60 * 60 + 24 * 60 * 60, $pairId, 0, $filter_interpreter);
     }
     $userspair =& JTable::getInstance('userspair', 'VideoTranslationTable');
     // $language->load($pair->langId1);
     $data->interpreters = $userspair->getInterpreters($pairId, $filter_interpreter);
     for ($i = 0; $i < 96; $i++) {
         $data->items[$i] = new stdClass();
         $data->items[$i]->time = date("G:i", $monday + $i * 15 * 60);
     }
     return $data;
 }
Exemple #4
0
    static function selectCategory($name, $params=array()) {

        $cfg = class_exists('JTheFactoryHelper') ? BidsHelperTools::getConfig() : new BidConfig();//so it can be used in modules too

        JModelLegacy::addIncludePath(JPATH_ROOT.DS.'components'.DS.'com_bids'.DS.'models');
        $model = JModelLegacy::getInstance('bidscategory','bidsmodel');
        $model->loadCategoryTree();

        $lang = JFactory::getLanguage();
        $lang->load('com_bids');

        $treeCat = $model->get('categories');

        $spacer = '&nbsp;&nbsp;&nbsp;';
        $opts = array();
        $opts[] = JHTML::_('select.option', '', JText::_('COM_BIDS_CHOOSE_CATEGORY') );
        foreach($treeCat as $c) {
            $text = '&nbsp;'.str_repeat($spacer,$c->depth).$c->title.PHP_EOL;
            $opts[] = JHTML::_('select.option',$c->id,$text, 'value', 'text', ($cfg->bid_opt_leaf_posting_only && $c->nrSubcategories) );
        }

        $name = isset($params['name']) ? $params['name'] : 'cat';
        $attribs = isset($params['attribs']) ? $params['attribs'] : '';
        $selected = isset($params["select"]) ? $params["select"] : '';

        return JHTML::_('select.genericlist', $opts, $name, $attribs, 'value', 'text', $selected);
    }
Exemple #5
0
 public function ajaxAction()
 {
     JSession::checkToken('get') or die;
     $actionId = JRequest::getInt('action');
     $href = JRequest::getVar('href');
     $href = urldecode($href);
     $params = JRequest::getVar('params');
     if (is_array($params)) {
         foreach ($params as $key => $value) {
             $params[$key] = rawurldecode($value);
         }
     } else {
         $params = array();
     }
     JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_jfbconnect/models');
     $jfbcOgActionModel = JModelLegacy::getInstance('OpenGraphAction', 'JFBConnectModel');
     $action = $jfbcOgActionModel->getAction($actionId);
     $response = $jfbcOgActionModel->triggerAction($action, $href, $params);
     if ($response->status) {
         echo $response->message;
     } else {
         if (JFBCFactory::config()->getSetting('facebook_display_errors') && $response->message != "") {
             echo "Error: " . $response->message;
         }
     }
     exit;
 }
Exemple #6
0
 /**
  *
  * @return unknown_type
  */
 function getItems()
 {
     // Check the registry to see if our Citruscart class has been overridden
     if (!class_exists('Citruscart')) {
         JLoader::register("Citruscart", JPATH_ADMINISTRATOR . "/components/com_citruscart/defines.php");
     }
     // load the config class
     Citruscart::load('Citruscart', 'defines');
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/tables');
     JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/models');
     // get the model
     $model = JModelLegacy::getInstance('Manufacturers', 'CitruscartModel');
     // TODO Make this depend on the current filter_category?
     // setting the model's state tells it what items to return
     $model->setState('filter_enabled', '1');
     $model->setState('order', 'tbl.manufacturer_name');
     // set the states based on the parameters
     // using the set filters, get a list
     $items = $model->getList();
     if (!empty($items)) {
         foreach ($items as $item) {
             // this gives error
             $item->itemid = Citruscart::getClass("CitruscartHelperRoute", 'helpers.route')->manufacturer($item->manufacturer_id, false);
             if (empty($item->itemid)) {
                 $item->itemid = $this->params->get('itemid');
             }
         }
     }
     return $items;
 }
Exemple #7
0
 /**
  * Overrides method to try to load model from extension if it exists
  */
 public static function getInstance($type, $prefix = '', $config = array())
 {
     $extensions = JoomleagueHelper::getExtensions(JRequest::getInt('p'));
     foreach ($extensions as $e => $extension) {
         $modelType = preg_replace('/[^A-Z0-9_\\.-]/i', '', $type);
         $modelClass = $prefix . ucfirst($modelType) . ucfirst($extension);
         $result = false;
         if (!class_exists($modelClass)) {
             jimport('joomla.filesystem.path');
             $path = JPath::find(parent::addIncludePath(null, $prefix), self::_createFileName('model', array('name' => $type)));
             if (!$path) {
                 $path = JPath::find(parent::addIncludePath(null, ''), self::_createFileName('model', array('name' => $type)));
             }
             if ($path) {
                 require_once $path;
                 if (class_exists($modelClass)) {
                     $result = new $modelClass($config);
                     return $result;
                 }
             }
         } else {
             $result = new $modelClass($config);
             return $result;
         }
     }
     // Still here ? Then the extension doesn't override this, use regular way
     return parent::getInstance($type, $prefix, $config);
 }
Exemple #8
0
 private function _getField()
 {
     $i = 0;
     $html = '';
     $customfields = $this->form->getValue('customfield', 'params');
     $customfields = $customfields['joomla'];
     jimport('joomla.application.component.model');
     if (version_compare(JVERSION, '3.0') < 0) {
         JModel::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_categories' . DS . 'models', 'categories');
         $model = JModel::getInstance('Categories', 'CategoriesModel', array('ignore_request' => true));
     } else {
         JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_categories/models', 'categories');
         $model = JModelLegacy::getInstance('Categories', 'CategoriesModel', array('ignore_request' => true));
     }
     $model->setState('list.limit', '200');
     $model->setState('filter.extension', 'com_content');
     $mitems = $model->getItems();
     $children = array();
     if ($mitems) {
         foreach ($mitems as $v) {
             $v->parent_id = @$v->parentid;
             $pt = @$v->parentid;
             $list = @$children[$pt] ? $children[$pt] : array();
             array_push($list, $v);
             $children[$pt] = $list;
         }
     }
     $mitems = array();
     foreach ($list as $item) {
         $item->treename = str_repeat('- ', $item->level - 1) . $item->title;
         $mitems[] = JHTML::_('select.option', $item->id, '   ' . $item->treename);
     }
     $output = JHTML::_('select.genericlist', $mitems, $this->name, 'class="inputbox" multiple="multiple" size="15"', 'value', 'text', $this->value, $this->id);
     return $output;
 }
Exemple #9
0
 function ThemeFlow()
 {
     $pathModelShowcaseTheme = JPATH_PLUGINS . DS . $this->_pluginType . DS . $this->_pluginName . DS . 'models';
     $pathTableShowcaseTheme = JPATH_PLUGINS . DS . $this->_pluginType . DS . $this->_pluginName . DS . 'tables';
     JModelLegacy::addIncludePath($pathModelShowcaseTheme);
     JTable::addIncludePath($pathTableShowcaseTheme);
 }
Exemple #10
0
 /**
  * Decorate the J2Store product information with its related Fabrik record
  *
  * @param $product
  *
  * @return object
  */
 private function getFabrikItem(&$product)
 {
     list($component, $listId) = explode('.', $product->product_source);
     $key = $listId . '.' . $product->product_source_id;
     static $sets;
     if (!is_array($sets)) {
         $sets = array();
     }
     if (!isset($sets[$key])) {
         JModelLegacy::addIncludePath(COM_FABRIK_FRONTEND . '/models', 'FabrikFEModel');
         /** @var FabrikFEModelList $listModel */
         $listModel = JModelLegacy::getInstance('List', 'FabrikFEModel');
         $listModel->setId($listId);
         $formModel = $listModel->getFormModel();
         $formModel->setRowId($product->product_source_id);
         $row = $formModel->getData();
         $params = $formModel->getParams();
         $index = array_search('j2store', (array) $params->get('plugins', array(), 'array'));
         $w = new FabrikWorker();
         $plugIn = FabrikWorker::getPluginManager()->loadPlugIn('j2store', 'form');
         // Set params relative to plugin render order
         $plugInParams = $plugIn->setParams($params, $index);
         $context = new stdClass();
         $context->title = $w->parseMessageForPlaceHolder($plugInParams->get('j2store_product_name'), $row);
         $context->published = $w->parseMessageForPlaceHolder($plugInParams->get('j2store_enabled'), $row);
         $objectRow = JArrayHelper::toObject($row);
         $context->viewLink = $listModel->viewDetailsLink($objectRow);
         $context->editLink = $listModel->editLink($objectRow);
         $context->id = $objectRow->__pk_val;
         $sets[$key] = $context;
     }
     //echo "<pre>";print_r($sets);echo "</pre>";
     return $sets[$key];
 }
Exemple #11
0
 function display($tpl = null)
 {
     $model = JFBCFactory::config();
     $jfbcLibrary = JFBCFactory::provider('facebook');
     require_once JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php';
     JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_templates/models');
     $templatesModel = JModelLegacy::getInstance('Styles', 'TemplatesModel');
     $allTemplates = $templatesModel->getItems();
     $templates = array();
     foreach ($allTemplates as $template) {
         if ($template->client_id == 0) {
             // Make it the same as J15 so we can use the same selectlist
             $template->directory = $template->id;
             $template->name = $template->title;
             $templates[] = $template;
         }
     }
     // Add the "Don't Override" option to set no special template
     $defaultTemplate = new stdClass();
     $defaultTemplate->directory = -1;
     $defaultTemplate->name = JText::_('COM_JFBCONNECT_CANVAS_DISPLAY_TEMPLATE_DEFAULT');
     array_unshift($templates, $defaultTemplate);
     require_once JPATH_ADMINISTRATOR . '/components/com_jfbconnect/controllers/canvas.php';
     $canvasProperties = JFBConnectControllerCanvas::setupCanvasProperties();
     $canvasTabTemplate = $model->getSetting('canvas_tab_template', -1);
     $canvasCanvasTemplate = $model->getSetting('canvas_canvas_template', -1);
     $this->assignRef('canvasProperties', $canvasProperties);
     $this->assignRef('canvasTabTemplate', $canvasTabTemplate);
     $this->assignRef('canvasCanvasTemplate', $canvasCanvasTemplate);
     $this->assignRef('templates', $templates);
     $this->assignRef('model', $model);
     $this->assignRef('jfbcLibrary', $jfbcLibrary);
     $this->addToolbar();
     parent::display($tpl);
 }
Exemple #12
0
 public static function getItems(&$params)
 {
     $id = (int) $params->get('autoridade', 0);
     $modo = $params->get('modo_agenda', '');
     $limit = (int) $params->get('limit_compromissos', -1);
     $order = $params->get('order_compromissos', 'NEXT_DESC');
     $params_dia = $params->get('dia', '');
     $featured = $params->get('featured_compromissos', '');
     if (!empty($featured) && !is_numeric($featured)) {
         $featured = '';
     }
     if (empty($params_dia)) {
         $params->set('dia', self::getDia($params));
     }
     JModelLegacy::addIncludePath(JPATH_ROOT . '/components/com_agendadirigentes/models', 'AgendaDirigentesModel');
     $model = JModelLegacy::getInstance('Compromissos', 'AgendaDirigentesModel', array('ignore_request' => true));
     $model->setState('autoridade.id', $id);
     $model->setState('participantes.load', false);
     $model->setState('filter.featured', $featured);
     $model->setState('params', $params);
     if ($limit > -1) {
         $model->setState('list.limit', $limit);
     }
     $items = $model->getItems();
     for ($i = 0, $limit = count($items); $i < $limit; $i++) {
         $items[$i]->horario_inicio = str_replace(':', 'h', $items[$i]->horario_inicio);
         $items[$i]->horario_fim = str_replace(':', 'h', $items[$i]->horario_fim);
     }
     return $items;
 }
 /**
  * Called via ajax to perform viz ajax task (defined by plugintask method)
  *
  * @param   boolean  $cachable   If true, the view output will be cached
  * @param   array    $urlparams  An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return  JController  A JController object to support chaining.
  */
 public function display($cachable = false, $urlparams = false)
 {
     $document = JFactory::getDocument();
     $app = JFactory::getApplication();
     $input = $app->input;
     $id = $input->getInt('visualizationid');
     $viz = FabTable::getInstance('Visualization', 'FabrikTable');
     $viz->load($id);
     $modelpaths = JModelLegacy::addIncludePath(JPATH_SITE . '/plugins/fabrik_visualization/' . $viz->plugin . '/models');
     $model = $this->getModel($viz->plugin);
     $model->setId($id);
     $pluginTask = $input->get('plugintask', '', 'request');
     if ($pluginTask !== '') {
         echo $model->{$pluginTask}();
     } else {
         $task = $input->get('task');
         $path = JPATH_SITE . '/plugins/fabrik_visualization/' . $viz->plugin . '/controllers/' . $viz->plugin . '.php';
         if (file_exists($path)) {
             require_once $path;
         } else {
             throw new RuntimeException('Could not load visualization: ' . $viz->plugin);
         }
         $controllerName = 'FabrikControllerVisualization' . $viz->plugin;
         $controller = new $controllerName();
         $controller->addViewPath(JPATH_SITE . '/plugins/fabrik_visualization/' . $viz->plugin . '/views');
         $controller->addViewPath(COM_FABRIK_FRONTEND . '/views');
         // Add the model path
         $modelpaths = JModelLegacy::addIncludePath(JPATH_SITE . '/plugins/fabrik_visualization/' . $viz->plugin . '/models');
         $modelpaths = JModelLegacy::addIncludePath(COM_FABRIK_FRONTEND . '/models');
         $origId = $input->getInt('visualizationid');
         $input->set('visualizationid', $id);
         $controller->{$task}();
     }
     return $this;
 }
Exemple #14
0
    protected function getTagHtml()
    {
        $requestID = $this->getParamValue('request_id');
        $linkText = $this->getParamValue('link_text');
        $linkImage = $this->getParamValue('link_image');
        $tagString = '';
        if ($requestID != '') {
            JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_jfbconnect/models');
            $requestModel = JModelLegacy::getInstance('Request', "JFBConnectModel");
            $request = $requestModel->getData($requestID);
            if ($request && $request->published) {
                $message = str_replace("\r\n", " ", $request->message);
                $linkValue = $linkText;
                if ($linkImage != '') {
                    $linkValue = '<img src="' . $linkImage . '" alt="' . $request->title . ' "/>';
                }
                $tagString = '<a href="javascript:void(0)" onclick="jfbc.request.popup(' . $requestID . '); return false;">' . $linkValue . '</a>';
                $tagString .= <<<EOT
                        <script type="text/javascript">
    var jfbcRequests = Object.prototype.toString.call(jfbcRequests) == "[object Array]" ? jfbcRequests : [];
    var jfbcRequest = new Object;
    jfbcRequest.title = "{$request->title}";
    jfbcRequest.message = "{$message}";
    jfbcRequest.destinationUrl = "{$request->destination_url}";
    jfbcRequest.thanksUrl = "{$request->thanks_url}";
    jfbcRequests[{$requestID}] = jfbcRequest;
</script>
EOT;
            }
        }
        return $tagString;
    }
 public static function &getBalance(&$params)
 {
     JModelLegacy::addIncludePath(JPATH_ROOT . '/components/com_videotranslation/models', 'VideoTranslationModel');
     $model = JModelLegacy::getInstance('cart', 'VideoTranslationModel', array('ignore_request' => true));
     $item = $model->getBalance();
     return $item;
 }
Exemple #16
0
 function ThemeStrip()
 {
     $pathModelShowcaseTheme = JPATH_PLUGINS . DIRECTORY_SEPARATOR . $this->_pluginType . DIRECTORY_SEPARATOR . $this->_pluginName . DIRECTORY_SEPARATOR . 'models';
     $pathTableShowcaseTheme = JPATH_PLUGINS . DIRECTORY_SEPARATOR . $this->_pluginType . DIRECTORY_SEPARATOR . $this->_pluginName . DIRECTORY_SEPARATOR . 'tables';
     JModelLegacy::addIncludePath($pathModelShowcaseTheme);
     JTable::addIncludePath($pathTableShowcaseTheme);
 }
Exemple #17
0
 public function display($cachable = false, $urlparams = false)
 {
     $session = JFactory::getSession();
     $session->clear('citruscart.opc.method');
     $session->clear('citruscart.opc.billingAddress');
     $session->clear('citruscart.opc.shippingAddress');
     $session->clear('citruscart.opc.shippingRates');
     $session->clear('citruscart.opc.shippingMethod');
     $session->clear('citruscart.opc.userCoupons');
     $session->clear('citruscart.opc.userCredit');
     $session->clear('citruscart.opc.requireShipping');
     if (!$this->user->id) {
         $session->set('old_sessionid', $session->getId());
     }
     $view = $this->getView($this->get('suffix'), 'html');
     $view->setTask(true);
     $order = $this->_order;
     $order = $this->populateOrder();
     $view->assign('order', $order);
     $view->assign('user', $this->user);
     JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/models');
     $model = JModelLegacy::getInstance('addresses', 'CitruscartModel');
     $model->setState("filter_userid", $this->user->id);
     $model->setState("filter_deleted", 0);
     $addresses = $model->getList();
     $view->assign('addresses', $addresses);
     $view->setModel($model);
     $showShipping = $order->isShippingRequired();
     $view->assign('showShipping', $showShipping);
     $session->set('citruscart.opc.requireShipping', serialize($showShipping));
     $view->assign('default_country', $this->default_country);
     $view->assign('default_country_id', $this->default_country_id);
     CitruscartController::display($cachable, $urlparams);
 }
Exemple #18
0
 /**
  * Plugin that returns the object list for DJ-Mediatools album
  * 
  * Each object must contain following properties (mandatory): title, description, image
  * Optional properties: link, target (_blank or _self), alt (alt attribute for image)
  * 
  * @param	object	The album params
  */
 public function onAlbumPrepare(&$source, &$params)
 {
     // Lets check the requirements
     $check = $this->onCheckRequirements($source);
     if (is_null($check) || is_string($check)) {
         return null;
     }
     $app = JFactory::getApplication();
     $default_image = $params->get('plg_k2_image');
     require_once JPATH_BASE . '/modules/mod_k2_content/helper.php';
     // fix K2 models path inclusion, we need to add path with prefix to avoid conflicts with other extensions
     JModelLegacy::addIncludePath(JPATH_BASE . '/components/com_k2/models', 'K2Model');
     // create parameters for K2 content module helper
     $mparams = new JRegistry();
     $mparams->def('itemCount', $params->get('max_images'));
     $mparams->def('source', $params->get('plg_k2_source'));
     $mparams->def('catfilter', $params->get('plg_k2_catfilter'));
     $mparams->set('category_id', $params->get('plg_k2_category_id', array()));
     $mparams->def('getChildren', $params->get('plg_k2_getChildren'));
     $mparams->def('itemsOrdering', $params->get('plg_k2_itemsOrdering'));
     $mparams->def('FeaturedItems', $params->get('plg_k2_FeaturedItems'));
     $mparams->def('popularityRange', $params->get('plg_k2_popularityRange'));
     $mparams->def('videosOnly', $params->get('plg_k2_videosOnly'));
     $mparams->def('item', $params->get('plg_k2_item'));
     $mparams->set('items', $params->get('plg_k2_items', array()));
     $mparams->def('itemImage', 1);
     $mparams->def('itemIntroText', 1);
     //JFactory::getApplication()->enqueueMessage("<pre>".print_r($mparams, true)."</pre>");
     //$mparams->def('extra_fields', 1);
     $items = modK2ContentHelper::getItems($mparams);
     $slides = array();
     foreach ($items as $item) {
         $slide = (object) array();
         if (isset($item->imageXLarge)) {
             $slide->image = str_replace(JURI::base(true), '', $item->imageXLarge);
         } else {
             $slide->image = DJMediatoolsLayoutHelper::getImageFromText($item->introtext);
         }
         // if no image found in article images and introtext then try fulltext
         if (!$slide->image) {
             $slide->image = DJMediatoolsLayoutHelper::getImageFromText($item->fulltext);
         }
         // if no image found in fulltext then take default image
         if (!$slide->image) {
             $slide->image = $default_image;
         }
         // if no default image set then don't display this article
         if (!$slide->image) {
             continue;
         }
         $slide->title = $item->title;
         $slide->description = $item->introtext;
         if (empty($slide->description)) {
             $slide->description = $item->fulltext;
         }
         $slide->link = $item->link;
         $slides[] = $slide;
     }
     return $slides;
 }
Exemple #19
0
 /**
  * Prepare data hook.
  *
  * @return  void
  */
 protected function prepareData()
 {
     require_once JPATH_SITE . '/components/com_content/helpers/route.php';
     $app = JFactory::getApplication();
     $data = $this->getData();
     $data->params = JComponentHelper::getParams('com_content');
     $data->user = $user = JUser::getInstance($app->input->getUsername('username'));
     JModelLegacy::addIncludePath(\Windwalker\Helper\PathHelper::getSite('com_content') . '/models');
     $model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
     $model->setState('params', $data->params);
     $access = !JComponentHelper::getParams('com_content')->get('show_noauth');
     $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
     $model->setState('filter.published', 1);
     $model->setState('filter.access', $access);
     $model->setState('filter.author_id', (int) $user->id);
     $model->setState('list.ordering', 'a.created');
     $model->setState('list.direction', 'DESC');
     $model->setState('list.limit', 10);
     $data->items = $model->getItems();
     $data->pagination = $model->getPagination();
     foreach ($data->items as &$item) {
         $item->slug = $item->id . ':' . $item->alias;
         $item->catslug = $item->catid . ':' . $item->category_alias;
         $item->params = $data->params;
         if ($access || in_array($item->access, $authorised)) {
             // We know that user has the privilege to view the article
             $item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid, $item->language));
         } else {
             $item->link = JRoute::_('index.php?option=com_users&view=login');
         }
         $item->parent_slug = $item->parent_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id;
         // No link for ROOT category
         if ($item->parent_alias == 'root') {
             $item->parent_slug = null;
         }
         $item->event = new stdClass();
         $dispatcher = JEventDispatcher::getInstance();
         // Old plugins: Ensure that text property is available
         if (!isset($item->text)) {
             $item->text = $item->introtext;
         }
         $app->input->set('option', 'com_content');
         $app->input->set('view', 'category');
         $app->input->set('layout', 'blog');
         JPluginHelper::importPlugin('content');
         $dispatcher->trigger('onContentPrepare', array('com_content.category', &$item, &$item->params, 0));
         // Old plugins: Use processed text as introtext
         $item->introtext = $item->text;
         $results = $dispatcher->trigger('onContentAfterTitle', array('com_content.category', &$item, &$item->params, 0));
         $item->event->afterDisplayTitle = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content.category', &$item, &$item->params, 0));
         $item->event->beforeDisplayContent = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentAfterDisplay', array('com_content.category', &$item, &$item->params, 0));
         $item->event->afterDisplayContent = trim(implode("\n", $results));
         $app->input->set('option', 'com_userxtd');
         $app->input->set('view', 'content');
         $app->input->set('layout', 'default');
     }
     $this->setTitle();
 }
 public function getRefuse()
 {
     $mainframe =& JFactory::getApplication();
     $order_id = JRequest::getInt('order_id');
     $order =& JTable::getInstance('order', 'VideoTranslationTable');
     $order->load($order_id);
     $vevent =& JTable::getInstance('vevent', 'VideoTranslationTable');
     $vevent->load($order->event_id);
     $event =& JTable::getInstance('event', 'VideoTranslationTable');
     $event->load($order->event_id);
     JModelLegacy::addIncludePath(JPATH_ROOT . '/components/com_videotranslation/models', 'VideoTranslationModel');
     $model = JModelLegacy::getInstance('approve', 'VideoTranslationModel', array('ignore_request' => true));
     //email to customer
     $model->sentInvitationEmail($order, $event, false);
     $amount = $order->amount;
     $user_id = $order->user_id;
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $query = "UPDATE #__vt_credits SET `amount`=`amount`+" . $amount . " WHERE user_id = " . $user_id;
     $db->setQuery($query);
     $db->query();
     $this->deleteEvent($order->event_id);
     $msg = JText::_('COM_VIDEOTRANSLATION_ORDER_WAS_DELETED');
     $mainframe->Redirect('index.php?option=com_videotranslation&view=eventsaved&Itemid=493', $msg);
     return false;
 }
Exemple #21
0
 /**
  * Method to display a view.
  *
  * @param   boolean  $cachable   If true, the view output will be cached
  * @param   mixed    $urlparams  An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return  JController   This object to support chaining.
  *
  * @since    1.5
  */
 public function display($cachable = true, $urlparams = false)
 {
     //error_log("In AkrecipesControllerRecipesbyuser::display" ) ;
     require_once JPATH_COMPONENT . '/helpers/akrecipes.php';
     $app = JFactory::getApplication();
     $view = $app->input->getCmd('view', 'recipesbyuser');
     JFactory::getApplication()->input->set('view', $view);
     //$model = $view->getModel();
     $userid = $app->input->getInt('id');
     JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_content/models');
     //$articles_model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
     $articles_model = JModelLegacy::getInstance('Articles', 'ContentModel', array());
     $articles_model->setState('filter.author_id', $userid);
     // $articles_model->setState('list.ordering', 'publish_up');
     // $articles_model->setState('list.direction', 'DESC');
     $app->input->set('filter_order', 'publish_up');
     $app->input->set('filter_order_Dir', 'DESC');
     //error_log("Articles --> " . $articles_model->getName())		;
     $document = JFactory::getDocument();
     $viewType = $document->getType();
     $viewName = $this->input->get('view', $this->default_view);
     $viewLayout = $this->input->get('layout', 'default', 'string');
     $view = $this->getView($viewName, $viewType, '', array('base_path' => $this->basePath, 'layout' => $viewLayout));
     // // Get/Create the model
     // if ($model = $this->getModel($viewName))
     // {
     // 	// Push the model into the view (as default)
     // 	$view->setModel($model, true);
     // }
     //$view->setModel($articles_model);
     //error_log("User is :: " . $userid) ;
     parent::display($cachable, $urlparams);
     return $this;
 }
 /**
  * Method to calculate statistics about manufacturers in an order
  * 
  * @param $items Array of order items
  * 
  * @return	Array with list of manufacturers and their stats
  */
 function calculateStatsOrder($items)
 {
     $db = JFactory::getDbo();
     JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/models');
     Citruscart::load('CitruscartQuery', 'library.query');
     $q = new CitruscartQuery();
     $q->select('manufacturer_id');
     $q->from('`#__citruscart_products`');
     $result = array();
     foreach ($items as $item) {
         $q->where('product_id = ' . (int) $item->product_id);
         $db->setQuery($q);
         $res = $db->loadObject();
         if ($res == null) {
             $man_id = 0;
         } else {
             $man_id = $res->manufacturer_id;
         }
         if (!isset($result[$man_id])) {
             $model = JModelLegacy::getInstance('Manufacturers', 'CitruscartModel');
             $model->setId($man_id);
             if (!($man_item = $model->getItem())) {
                 $man_item = new stdClass();
             }
             $result[$man_id] = $man_item;
             $result[$man_id]->subtotal = 0;
             $result[$man_id]->total_tax = 0;
         }
         $result[$man_id]->subtotal += $item->orderitem_final_price;
         $result[$man_id]->total_tax += $item->orderitem_tax;
     }
     return $result;
 }
Exemple #23
0
 /**
  * Plugin that returns the object list for DJ-Mediatools album
  * 
  * Each object must contain following properties (mandatory): title, description, image
  * Optional properties: link, target (_blank or _self), alt (alt attribute for image)
  * 
  * @param	object	The album params
  */
 public function onAlbumPrepare(&$source, &$params)
 {
     // Lets check the requirements
     $check = $this->onCheckRequirements($source);
     if (is_null($check) || is_string($check)) {
         return null;
     }
     $app = JFactory::getApplication();
     require_once JPATH_BASE . DS . 'components' . DS . 'com_djcatalog2' . DS . 'helpers' . DS . 'route.php';
     JModelLegacy::addIncludePath(JPATH_BASE . DS . 'components' . DS . 'com_djcatalog2' . DS . 'models');
     $model = JModelLegacy::getInstance('Items', 'Djcatalog2Model', array('ignore_request' => true));
     $order = $params->get('plg_catalog2_orderby', 'i.ordering');
     $order_Dir = $params->get('plg_catalog2_orderdir', 'asc');
     $order_featured = $params->get('plg_catalog2_featured_first', 0);
     $filter_catid = $params->get('plg_catalog2_catid', array());
     $filter_itemids = $params->get('plg_catalog2_item_ids', null);
     $filter_featured = $params->get('plg_catalog2_featured_only', 0);
     $limit = $params->get('max_images');
     $default_image = $params->get('plg_catalog2_image');
     $cparams = $app->getParams('com_djcatalog2');
     $cparams->set('product_catalogue', 0);
     $model->setState('params', $cparams);
     $model->setState('list.start', 0);
     $model->setState('list.limit', $limit);
     $model->setState('filter.category', $filter_catid);
     $model->setState('filter.catalogue', false);
     $model->setState('filter.featured', $filter_featured);
     $model->setState('list.ordering_featured', $order_featured);
     $model->setState('list.ordering', $order);
     $model->setState('list.direction', $order_Dir);
     if ($filter_itemids) {
         $filter_itemids = explode(',', $filter_itemids);
         JArrayHelper::toInteger($filter_itemids);
         $model->setState('filter.item_ids', $filter_itemids);
     }
     $items = $model->getItems();
     $slides = array();
     foreach ($items as $item) {
         $slide = (object) array();
         if (!empty($item->image_fullpath)) {
             $slide->image = 'media/djcatalog2/images/' . $item->image_fullpath;
         } else {
             if (!empty($item->item_image)) {
                 $slide->image = 'media/djcatalog2/images/' . $item->item_image;
             } else {
                 if (!empty($default_image)) {
                     $slide->image = $default_image;
                 } else {
                     continue;
                 }
             }
         }
         $slide->title = $item->name;
         $slide->description = $item->intro_desc;
         $slide->link = JRoute::_(DJCatalogHelperRoute::getItemRoute($item->slug, $item->catslug));
         $slide->alt = $item->image_caption;
         $slides[] = $slide;
     }
     return $slides;
 }
Exemple #24
0
 public static function showForm($itemId, $itemType, $title = '')
 {
     JModelLegacy::addIncludePath(JPATH_ROOT . '/components/com_hp_comment/models', 'Hp_CommentModel');
     $model = JModelLegacy::getInstance('Comment', 'Hp_CommentModel');
     $listComments = $model->getListComments($itemId, $itemType, $title);
     include_once JPATH_ROOT . DS . 'components/com_hp_comment/views/forms/comment.php';
 }
Exemple #25
0
 public function display($cachable = true, $urlparams = false)
 {
     //error_log("IN AkrecipesControllerBrand::display ")		;
     $app = JFactory::getApplication();
     $view = $app->input->getCmd('view', 'brand');
     JFactory::getApplication()->input->set('view', $view);
     //error_log("Recipes Brand Param --> " . print_r($app->getParams(),true));
     $brand_id = $app->input->getInt('id');
     //error_log("brand_id --> " . $brand_id);
     JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_akrecipes/models');
     //$recipes_model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
     $recipes_model = JModelLegacy::getInstance('Recipes', 'AkrecipesModel', array());
     $num_recipes = (int) $app->getParams()->get('brandpage_num_recipes', 24);
     $app->input->set('limit', $num_recipes);
     $app->input->set('ignore_intro_leading', true);
     //$recipes_model->setState('list.limit',$num_recipes);
     $recipes_model->setState('filter.brand_id', $brand_id);
     $recipes_model->setState('catid.id', '');
     $app->input->set('filter_order', 'publish_up');
     $app->input->set('filter_order_Dir', 'DESC');
     $document = JFactory::getDocument();
     $viewType = $document->getType();
     $viewName = $this->input->get('view', $this->default_view);
     $viewLayout = $this->input->get('layout', 'default', 'string');
     $view = $this->getView($viewName, $viewType, '', array('base_path' => $this->basePath, 'layout' => $viewLayout));
     // // Get/Create the model
     // if ($model = $this->getModel($viewName))
     // {
     // 	// Push the model into the view (as default)
     // 	$view->setModel($model, true);
     // }
     $view->setModel($recipes_model);
     parent::display($cachable, $urlparams);
     return $this;
 }
Exemple #26
0
 /**
  * Method to change the block status on a record.
  *
  * @return  void
  *
  * @since   0.3.0
  */
 public function changeBlock()
 {
     // Check for request forgeries.
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $ids = $this->input->get('cid', array(), 'array');
     $values = array('block' => 1, 'unblock' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($values, $task, 0, 'int');
     // Convert from customer ID to Joomla user ID
     $joomlaUserIds = array();
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_solidres/tables', 'SolidresTable');
     $customerTable = JTable::getInstance('Customer', 'SolidresTable');
     foreach ($ids as $id) {
         $customerTable->load($id);
         $joomlaUserIds[] = $customerTable->user_id;
     }
     if (empty($joomlaUserIds)) {
         JError::raiseWarning(500, JText::_('SR_CUSTOMERS_NO_ITEM_SELECTED'));
     } else {
         // Get the model.
         JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_users/models', 'UsersModel');
         $model = JModelLegacy::getInstance('User', 'UsersModel', array('ignore_request' => true));
         // Change the state of the records.
         if (!$model->block($joomlaUserIds, $value)) {
             JError::raiseWarning(500, $model->getError());
         } else {
             if ($value == 1) {
                 $this->setMessage(JText::plural('SR_N_CUSTOMERS_BLOCKED', count($joomlaUserIds)));
             } elseif ($value == 0) {
                 $this->setMessage(JText::plural('SR_N_CUSTOMERS_UNBLOCKED', count($joomlaUserIds)));
             }
         }
     }
     $this->setRedirect('index.php?option=com_solidres&view=customers');
 }
Exemple #27
0
 /**
  * @param array $twitterId
  * @param $orderType
  * @param $maxItemDisplayed
  * @return array
  */
 public static function getTwitterList($twitterId = array(), $orderType = 0, $maxItemDisplayed = 10, $params = array())
 {
     JModelLegacy::addIncludePath(JPATH_ROOT . '/components/com_redtwitter/models', 'redtwitterModelfollowedprofiles');
     $model = JModelLegacy::getInstance('followedprofiles', 'redtwitterModel', array('ignore_request' => true));
     $twitterUserList =& $model->getData($twitterId);
     $twitterDataTimelines = RedtwitterHelper::getAllUserTimeline($twitterUserList, $orderType, $maxItemDisplayed, $params);
     return $twitterDataTimelines;
 }
 /**
  * @testdox  Ensure addModelPath() adds a model path to the internal array
  *
  * @covers   JControllerLegacy::addModelPath
  */
 public function testAddModelPath()
 {
     $path = JPath::clean(JPATH_ROOT . '/addmodelpath');
     JControllerLegacy::addModelPath($path);
     // The default path is the class file folder/forms
     $valid = JPATH_PLATFORM . '/joomla/form/fields';
     $this->assertTrue(in_array($path, JModelLegacy::addIncludePath()), 'Line:' . __LINE__ . ' The path should be added to the JModel paths.');
 }
 /**
  * Performs the database update
  *
  * @param InputInterface $input cli input object
  *
  * @return void
  */
 protected function updateDb(InputInterface $input)
 {
     $joomlaApp = Bootstrapper::getApplication($input->getOption('path'));
     \JModelLegacy::addIncludePath($joomlaApp->getPath() . '/administrator/components/com_installer/models', 'InstallerModel');
     /* @var $model \InstallerModelDatabase */
     $model = \JModelLegacy::getInstance('Database', 'InstallerModel');
     $model->fix();
 }
 function getInvitationTextArea()
 {
     require_once JPATH_SITE . '/components/com_videotranslation/lib/russian-date.php';
     JModelLegacy::addIncludePath(JPATH_ROOT . '/components/com_videotranslation/models', 'VideoTranslationModel');
     $cart_model = JModelLegacy::getInstance('Cart', 'VideoTranslationModel', array('ignore_request' => true));
     $items = $cart_model->getItems();
     //echo date('Y m d H:i:s',$items[0]->start); die;
     //        echo "<pre>";
     //        print_r($items); die;
     $this->items = $items;
     $session = JFactory::getSession();
     $cart = $session->get('cart');
     $this->difference = $this->differenceTimeInviterInvitee($cart['my_partner_timezone'], $cart['my_timezone']);
     //      $this->difference = 0;
     //     echo $this->difference; die;
     //echo $cart['my_partner_timezone']; die;
     $languageTable =& JTable::getInstance('language', 'VideoTranslationTable');
     $languageTable->load($cart['your_partner_language']);
     $lang = JFactory::getLanguage();
     $lang->load('com_videotranslation', JPATH_SITE, $languageTable->system_language);
     $tag = substr($languageTable->system_language, 0, 2);
     $link = '[LINK]';
     //        $time = ' ';
     //        for($i=0;$i<count($items);$i++) {
     //
     //            $time
     //
     //        }
     //        echo "<pre>";
     //        print_r($items); die;
     $text = JText::sprintf('COM_VIDEOTRANSLATION_BODY_PARTNER1', maxsite_the_russian_time(date('j F', $items[0]->start + $this->difference), $tag), date('H:i', $items[0]->start + $this->difference), date('H:i', $items[0]->end + $this->difference), $cart['my_partner_timezone'], $link);
     $text = str_replace("<br />", "\r\n", $text);
     $lang->load('com_videotranslation', JPATH_SITE, $lang->getTag(), true);
     return $text;
 }