protected function getAllContents($data) { $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select('distinct p.idcontenuto AS idcontenuto, c.titolo as titolo, c.descrizione as descrizione '); $query->from('#__gg_palinsesti as p '); $query->join('left', '#__gg_contenuti as c ON c.id = p.idcontenuto '); $query->where('idcontenuto not in (select idcontenuto from #_tv_palinsesti where datapalinsesto = "' . $data . '" )'); $query->order('datapalinsesto desc, ordinamento '); debug::msg((string) $query); $db->setQuery((string) $query, 0, 20); $res = $db->loadAssocList(); return $res; }
public function _processor($options = false) { if (is_array($options)) { $options = (object) $options; } $force_json = gettype($options) == 'object' && isset($options->force_json) && $options->force_json ? true : false; $force_stop = gettype($options) == 'object' && isset($options->force_stop) && $options->force_stop ? true : false; $not_redirect = gettype($options) == 'object' && isset($options->not_redirect) && $options->not_redirect ? true : false; if ($this->transaction && debug::$status) { if (isset($this->sql)) { $this->sql->commit(); } if (count($this->commit)) { call_user_func_array($this->commit[0], array_slice($this->commit, 1)); } } elseif ($this->transaction && !debug::$status) { if (isset($this->sql)) { $this->sql->rollback(); } if (count($this->rollback)) { call_user_func_array($this->rollback[0], array_slice($this->rollback, 1)); } } if ($not_redirect) { $this->controller()->redirector = false; } if (\saloos::is_json_accept() || $force_json) { header('Content-Type: application/json'); if (isset($this->controller()->redirector) && $this->controller()->redirector) { $_SESSION['debug'][md5(strtok($this->redirector()->redirect(true), '?'))] = debug::compile(); debug::msg("redirect", $this->redirector()->redirect(true)); } echo debug::compile(true); } elseif (!\lib\router::get_storage('api') && strtolower($_SERVER['REQUEST_METHOD']) == "post") { $this->redirector(); } if (isset($this->controller()->redirector) && $this->controller()->redirector && !\saloos::is_json_accept()) { $_SESSION['debug'][md5(strtok($this->redirector()->redirect(true), '?'))] = debug::compile(); $this->redirector()->redirect(); } if ($force_stop) { exit; } }
public function get_congressi($type) { try { $type = filter_var($type, FILTER_VALIDATE_INT, array('options' => array('min_range' => self::TYPE_VIRTUALFORUM, 'max_range' => self::TYPE_SPECIALECONGRESSI))); if (empty($type)) throw new BadMethodCallException('Virtual Forum o Speciale Congressi?', E_USER_ERROR); $query = 'SELECT id, congresso, alias FROM psn_gg_congressi WHERE pubblicato = 1 AND tipologia=' . $type . ' ORDER BY ordinamento DESC'; $this->_db->setQuery($query); debug::msg($query); return $this->_db->loadAssocList(); } catch (Exception $e) { debug::exception($e); return array(); } }
public function get_congresso($id) { try { debug::vardump($id, 'id'); $id = filter_var($id, FILTER_VALIDATE_INT, array('options' => array('min_range' => 1))); if (empty($id)) throw new BadMethodCallException('Identificativo congresso non specificato o non valido', E_USER_ERROR); $query = 'SELECT c.congresso, c.banner, c.abstract AS abstract_congresso, c.alias AS alias_congresso, i.* FROM #__gg_congressi AS c LEFT JOIN #__gg_contenuti AS i ON i.id_congresso = c.id WHERE c.pubblicato = 1 AND c.id = ' . $id; $this->_db->setQuery($query); debug::msg($query); return $this->_db->loadAssocList(); } catch (Exception $e) { debug::exception($e); } }
/** * Traccio la visualizzazioen */ public function setTrack($user_id, $content_id, $tpl) { try { $query = "INSERT INTO #__gg_log (id_utente, id_contenuto, data_accesso, supporto) values($user_id, $content_id, now(), '$tpl') "; debug::msg($query); $this->_db->setQuery($query); if (false === ($results = $this->_db->query())) throw new RuntimeException($this->_db->getErrorMsg(), E_USER_ERROR); return $results; } catch (Exception $e) { jimport('joomla.error.log'); $log = &JLog::getInstance('com_gglms.log.php'); $log->addEntry(array('comment' => $e->getMessage(), 'status' => $e->getCopde)); if ($this->_dbg) $this->_japp->enqueueMessage($e->getMessage(), 'error'); } }