Ejemplo n.º 1
0
 /**
  * Initialize the object
  * @param string
  */
 public function __construct($strTable)
 {
     $this->import('Session');
     $this->intGroupId = (int) \Session::getInstance()->get('iso_products_gid');
     // Check if the group exists
     if ($this->intGroupId > 0) {
         $objGroup = \Isotope\Model\Group::findByPk($this->intGroupId);
         if (null === $objGroup) {
             if (\BackendUser::getInstance()->isAdmin || !is_array(\BackendUser::getInstance()->iso_groups)) {
                 $this->intGroupId = 0;
             } elseif (!\BackendUser::getInstance()->isAdmin) {
                 $this->intGroupId = (int) \Database::getInstance()->prepare("SELECT id FROM " . \Isotope\Model\Group::getTable() . " WHERE id IN ('" . implode("','", \BackendUser::getInstance()->iso_groups) . "') ORDER BY " . \Database::getInstance()->findInSet('id', \BackendUser::getInstance()->iso_groups))->limit(1)->execute()->id;
             }
         }
     }
     // Redirect if the product was not found
     if (isset($_GET['id'])) {
         $objProduct = \Database::getInstance()->prepare("SELECT id FROM " . $strTable . " WHERE id=?")->limit(1)->execute(\Input::get('id', true));
         if (!$objProduct->numRows) {
             \Controller::redirect(preg_replace('/(&)?id=[^&]*/i', '', \Environment::get('request')));
         }
     }
     $arrClipboard = $this->Session->get('CLIPBOARD');
     // Cut all records
     if ($arrClipboard[$strTable]['mode'] == 'cutAll' && \Input::get('act') != 'cutAll') {
         \Controller::redirect(\Backend::addToUrl('&act=cutAll'));
     }
     parent::__construct($strTable);
 }
Ejemplo n.º 2
0
 /**
  * Initialize the object
  * @param string
  */
 public function __construct($strTable)
 {
     $this->import('Environment');
     $this->Environment->request = preg_replace('/&loadDeferredProduct=[^&]*&level=[^&]*/', '', $this->Environment->request);
     $this->Environment->requestUri = preg_replace('/&loadDeferredProduct=[^&]*&level=[^&]*/', '', $this->Environment->requestUri);
     $this->Environment->queryString = preg_replace('/&loadDeferredProduct=[^&]*&level=[^&]*/', '', $this->Environment->queryString);
     parent::__construct($strTable);
 }
Ejemplo n.º 3
0
 /**
  * Initialize the object
  * @param string
  */
 public function __construct($strTable)
 {
     $this->import('Session');
     $this->intGroupId = (int) \Session::getInstance()->get('iso_products_gid');
     // Check if the group exists
     if ($this->intGroupId > 0) {
         $objGroup = \Isotope\Model\Group::findByPk($this->intGroupId);
         if (null === $objGroup) {
             if (\BackendUser::getInstance()->isAdmin || !is_array(\BackendUser::getInstance()->iso_groups)) {
                 $this->intGroupId = 0;
             } elseif (!\BackendUser::getInstance()->isAdmin) {
                 $this->intGroupId = (int) \Database::getInstance()->prepare("SELECT id FROM tl_iso_group WHERE id IN ('" . implode("','", \BackendUser::getInstance()->iso_groups) . "') ORDER BY " . \Database::getInstance()->findInSet('id', \BackendUser::getInstance()->iso_groups))->limit(1)->execute()->id;
             }
         }
     }
     // Redirect if the product was not found
     if (isset($_GET['id'])) {
         $objProduct = \Database::getInstance()->prepare("SELECT id FROM {$strTable} WHERE id=?")->limit(1)->execute(\Input::get('id', true));
         if (!$objProduct->numRows) {
             \Controller::redirect(preg_replace('/(&)?id=[^&]*/i', '', \Environment::get('request')));
         }
     }
     $arrClipboard = $this->Session->get('CLIPBOARD');
     // Cut all records
     if ($arrClipboard[$strTable]['mode'] == 'cutAll' && \Input::get('act') != 'cutAll') {
         \Controller::redirect(\Backend::addToUrl('&act=cutAll'));
     }
     parent::__construct($strTable);
     // Allow to customize languages via the onload_callback
     if (isset($GLOBALS['TL_DCA'][$this->strTable]['config']['languages'])) {
         $arrPageLanguages = $GLOBALS['TL_DCA'][$this->strTable]['config']['languages'];
     } else {
         $arrPageLanguages = array_map(function ($strLang) {
             return str_replace('-', '_', $strLang);
         }, $this->Database->execute("SELECT DISTINCT language FROM tl_page WHERE type='root' AND language!=''")->fetchEach('language'));
     }
     if (count($arrPageLanguages) > 1) {
         $this->arrTranslationLabels = \System::getLanguages();
         $this->arrTranslations = array_intersect(array_keys($this->arrTranslationLabels), $arrPageLanguages);
     }
 }