当前位置: 首页>>代码示例>>PHP>>正文


PHP CampCache::IsEnabled方法代码示例

本文整理汇总了PHP中CampCache::IsEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP CampCache::IsEnabled方法的具体用法?PHP CampCache::IsEnabled怎么用?PHP CampCache::IsEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CampCache的用法示例。


在下文中一共展示了CampCache::IsEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetList

 /**
  * Gets an issues list based on the given parameters.
  *
  * @param integer $p_context_id
  *    The Context Box Identifier
  * @param string $p_order
  *    An array of columns and directions to order by
  * @param integer $p_start
  *    The record number to start the list
  * @param integer $p_limit
  *    The offset. How many records from $p_start will be retrieved.
  * @param integer $p_count
  *    The total count of the elements; this count is computed without
  *    applying the start ($p_start) and limit parameters ($p_limit)
  *
  * @return array $issuesList
  *    An array of Issue objects
  */
 public static function GetList($p_context_id, $p_order = null, $p_start = 0, $p_limit = 0, &$p_count, $p_skipCache = false)
 {
     global $g_ado_db;
     if (!$p_skipCache && CampCache::IsEnabled()) {
         $paramsArray['parameters'] = serialize($p_parameters);
         $paramsArray['order'] = is_null($p_order) ? 'id desc' : $p_order;
         $paramsArray['start'] = $p_start;
         $paramsArray['limit'] = $p_limit;
         $cacheListObj = new CampCacheList($paramsArray, __METHOD__);
         $issuesList = $cacheListObj->fetchFromCache();
         if ($issuesList !== false && is_array($issuesList)) {
             return $issuesList;
         }
     }
     $returnArray = array();
     $sql = 'SELECT fk_article_no FROM context_articles
             WHERE fk_context_id = ' . $p_context_id . '
             ORDER BY id desc';
     $rows = $g_ado_db->GetAll($sql);
     if (is_array($rows)) {
         foreach ($rows as $row) {
             $returnArray[] = $row['fk_article_no'];
         }
     }
     $p_count = count($returnArray);
     return array_reverse($returnArray);
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:45,代码来源:ContextBoxArticle.php

示例2: GetList

 /**
  * Gets an issues list based on the given parameters.
  *
  * @param integer $p_context_id
  *    The Context Box Identifier
  * @param string $p_order
  *    An array of columns and directions to order by
  * @param integer $p_start
  *    The record number to start the list
  * @param integer $p_limit
  *    The offset. How many records from $p_start will be retrieved.
  * @param integer $p_count
  *    The total count of the elements; this count is computed without
  *    applying the start ($p_start) and limit parameters ($p_limit)
  *
  * @return array $issuesList
  *    An array of Issue objects
  */
 public static function GetList(array $params, $p_order = null, $p_start = 0, $p_limit = 0, &$p_count, $p_skipCache = false)
 {
     global $g_ado_db;
     if (!$p_skipCache && CampCache::IsEnabled()) {
         $paramsArray['parameters'] = serialize($params);
         $paramsArray['order'] = is_null($p_order) ? 'id' : $p_order;
         $paramsArray['start'] = $p_start;
         $paramsArray['limit'] = $p_limit;
         $cacheListObj = new CampCacheList($paramsArray, __METHOD__);
         $issuesList = $cacheListObj->fetchFromCache();
         if ($issuesList !== false && is_array($issuesList)) {
             return $issuesList;
         }
     }
     if (isset($params['role']) && $params['role'] == 'child') {
         $sql = 'SELECT b.fk_article_no FROM context_boxes b, Articles a0' . ' WHERE a0.Number = b.fk_article_no AND ' . ' a0.Type = "dossier" AND ' . ' b.id IN (SELECT c.fk_context_id ' . '     FROM Articles a, context_articles c ' . '     WHERE c.fk_article_no = ' . $params['article'] . '     AND a.Number = c.fk_article_no)' . ' ORDER BY a0.PublishDate DESC';
     } else {
         $sql = 'SELECT fk_article_no FROM context_articles' . ' WHERE fk_context_id = ' . $params['context_box'] . ' ORDER BY id';
     }
     if ($p_limit > 0) {
         $sql .= ' LIMIT ' . $p_limit;
     }
     $returnArray = array();
     $rows = $g_ado_db->GetAll($sql);
     if (is_array($rows)) {
         foreach ($rows as $row) {
             $returnArray[] = $row['fk_article_no'];
         }
     }
     $p_count = count($returnArray);
     return $returnArray;
 }
开发者ID:alvsgithub,项目名称:Newscoop,代码行数:50,代码来源:ContextBoxArticle.php

示例3: camp_load_translation_strings

camp_load_translation_strings('articles');
camp_load_translation_strings('api');
camp_load_translation_strings('extensions');
camp_load_translation_strings('globals');

// install default widgets for admin
WidgetManager::SetDefaultWidgetsAll();

// add title
echo camp_html_breadcrumbs(array(
    array(getGS('Dashboard'), ''),
));

// clear cache
$clearCache = Input::Get('clear_cache', 'string', 'no', true);
if ((CampCache::IsEnabled() || CampTemplateCache::factory()) && ($clearCache == 'yes')
        && $g_user->hasPermission('ClearCache')) {
    // Clear cache engine's cache
    CampCache::singleton()->clear('user');
    CampCache::singleton()->clear();
    SystemPref::DeleteSystemPrefsFromCache();

    // Clear compiled templates
    require_once dirname(dirname(__FILE__)) . '/template_engine/classes/CampTemplate.php';
    CampTemplate::singleton()->clear_compiled_tpl();

    // Clear template cache storage
    if (CampTemplateCache::factory()) CampTemplateCache::factory()->clean();

    $actionMsg = getGS('Newscoop cache was cleaned up');
    $res = 'OK';
开发者ID:nistormihai,项目名称:Newscoop,代码行数:31,代码来源:home.php

示例4: sha1

    $installationId = sha1($_SERVER['SERVER_ADDR'] . $_SERVER['SERVER_NAME'] . mt_rand());
    SystemPref::set('installation_id', $installationId);
}
$request_only = false;
if (!SystemPref::get('support_send') && SystemPref::get('stat_ask_time') <= time() && empty($_SESSION['statDisplayed'])) {
    $statUrl = $Campsite['WEBSITE_URL'] . '/admin/support/popup';
    $request_only = true;
    ?>
<a style="display: none;" id="dummy_stat_link" href="<?php 
    echo $statUrl;
    ?>
"></a><?php 
}
// clear cache
$clearCache = Input::Get('clear_cache', 'string', 'no', true);
if ((CampCache::IsEnabled() || CampTemplateCache::factory()) && $clearCache == 'yes' && $g_user->hasPermission('ClearCache')) {
    // Clear cache engine's cache
    CampCache::singleton()->clear('user');
    CampCache::singleton()->clear();
    SystemPref::DeleteSystemPrefsFromCache();
    // Clear compiled templates
    require_once dirname(dirname(__FILE__)) . '/template_engine/classes/CampTemplate.php';
    CampTemplate::singleton()->clearCompiledTemplate();
    // Clear template cache storage
    if (CampTemplateCache::factory()) {
        CampTemplateCache::factory()->clean();
    }
    $actionMsg = getGS('Newscoop cache was cleaned up');
    $res = 'OK';
}
?>
开发者ID:nidzix,项目名称:Newscoop,代码行数:31,代码来源:home.php

示例5: GetList

 /**
  * Returns an article authors list based on the given parameters.
  *
  * @param array $p_parameters
  *    An array of ComparisonOperation objects
  * @param string $p_order
  *    An array of columns and directions to order by
  * @param integer $p_start
  *    The record number to start the list
  * @param integer $p_limit
  *    The offset. How many records from $p_start will be retrieved.
  * @param integer $p_count
  *    The total count of the elements; this count is computed without
  *    applying the start ($p_start) and limit parameters ($p_limit)
  *
  * @return array $articleAuthorsList
  *    An array of Author objects
  */
 public static function GetList(array $p_parameters, $p_order = null, $p_start = 0, $p_limit = 0, &$p_count, $p_skipCache = false)
 {
     global $g_ado_db;
     if (!$p_skipCache && CampCache::IsEnabled()) {
         $paramsArray['parameters'] = serialize($p_parameters);
         $paramsArray['order'] = is_null($p_order) ? 'order' : $p_order;
         $paramsArray['start'] = $p_start;
         $paramsArray['limit'] = $p_limit;
         $cacheListObj = new CampCacheList($paramsArray, __METHOD__);
         $articleAuthorsList = $cacheListObj->fetchFromCache();
         if ($articleAuthorsList !== false && is_array($articleAuthorsList)) {
             return $articleAuthorsList;
         }
     }
     $hasArticleNr = false;
     $selectClauseObj = new SQLSelectClause();
     $countClauseObj = new SQLSelectClause();
     // sets the where conditions
     foreach ($p_parameters as $param) {
         if ($param->getLeftOperand() == 'type') {
             $whereCondition = 'fk_type_id ' . $param->getOperator()->getSymbol() . ' (SELECT id FROM ' . AuthorType::TABLE . ' WHERE type="' . str_replace("'", "", $param->getRightOperand()) . '")';
             $selectClauseObj->addWhere($whereCondition);
             $countClauseObj->addWhere($whereCondition);
         }
         if ($param->getLeftOperand() == 'id') {
             $whereCondition = 'fk_author_id ' . $param->getOperator()->getSymbol() . ' ' . $param->getRightOperand();
             $selectClauseObj->addWhere($whereCondition);
             $countClauseObj->addWhere($whereCondition);
         }
         $comparisonOperation = self::ProcessListParameters($param);
         if (sizeof($comparisonOperation) < 1) {
             break;
         }
         switch (key($comparisonOperation)) {
             case 'fk_article_number':
                 $whereCondition = 'fk_article_number = ' . $comparisonOperation['fk_article_number'];
                 $hasArticleNr = true;
                 break;
             case 'fk_language_id':
                 $whereCondition = '(fk_language_id IS NULL OR ' . 'fk_language_id = ' . $comparisonOperation['fk_language_id'] . ')';
                 break;
         }
         $selectClauseObj->addWhere($whereCondition);
         $countClauseObj->addWhere($whereCondition);
     }
     // validates whether article number was given
     if ($hasArticleNr === false) {
         CampTemplate::singleton()->trigger_error("missed parameter Article Number in statement list_article_authors");
     }
     // sets the base table ArticleAuthors and the column to be fetched
     $tmpArticleAuthor = new ArticleAuthor();
     $selectClauseObj->setTable($tmpArticleAuthor->getDbTableName());
     $selectClauseObj->addJoin('JOIN ' . Author::TABLE . ' ON fk_author_id = id');
     $selectClauseObj->addColumn('fk_author_id');
     $selectClauseObj->addColumn('fk_type_id');
     $countClauseObj->setTable($tmpArticleAuthor->getDbTableName());
     $countClauseObj->addColumn('COUNT(*)');
     unset($tmpArticleAuthor);
     if (!is_array($p_order)) {
         $p_order = array();
     }
     $order = self::ProcessListOrder($p_order);
     // sets the order condition if any
     foreach ($order as $orderDesc) {
         $orderField = $orderDesc['field'];
         $orderDirection = $orderDesc['dir'];
         $selectClauseObj->addOrderBy($orderField . ' ' . $orderDirection);
     }
     // sets the limit
     $selectClauseObj->setLimit($p_start, $p_limit);
     // builds the query and executes it
     $selectQuery = $selectClauseObj->buildQuery();
     $authors = $g_ado_db->GetAll($selectQuery);
     if (is_array($authors)) {
         $countQuery = $countClauseObj->buildQuery();
         $p_count = $g_ado_db->GetOne($countQuery);
         // builds the array of attachment objects
         $authorsList = array();
         foreach ($authors as $author) {
             $authorObj = new Author($author['fk_author_id'], $author['fk_type_id']);
             if ($authorObj->exists()) {
                 $authorsList[] = $authorObj;
//.........这里部分代码省略.........
开发者ID:sourcefabric,项目名称:newscoop,代码行数:101,代码来源:ArticleAuthor.php

示例6: deleteFromCache

 public function deleteFromCache()
 {
     if (CampCache::IsEnabled()) {
         CampCache::singleton()->delete($this->getCacheKey());
     }
 }
开发者ID:sourcefabric,项目名称:newscoop,代码行数:6,代码来源:CampCacheList.php

示例7: GetList

    /**
     * Returns an article comments list based on the given parameters.
     *
     * @param array $p_parameters
     *    An array of ComparisonOperation objects
     * @param string $p_order
     *    An array of columns and directions to order by
     * @param integer $p_start
     *    The record number to start the list
     * @param integer $p_limit
     *    The offset. How many records from $p_start will be retrieved.
     * @param integer $p_count
     *    The total count of the elements; this count is computed without
     *    applying the start ($p_start) and limit parameters ($p_limit)
     *
     * @return array $articleCommentsList
     *    An array of Comment objects
     */
    public static function GetList(array $p_parameters, $p_order = null,
                                   $p_start = 0, $p_limit = 0, &$p_count, $p_skipCache = false)
    {
        global $g_ado_db, $PHORUM;

        if (!$p_skipCache && CampCache::IsEnabled()) {
        	$paramsArray['parameters'] = serialize($p_parameters);
        	$paramsArray['order'] = (is_null($p_order)) ? 'null' : $p_order;
        	$paramsArray['start'] = $p_start;
        	$paramsArray['limit'] = $p_limit;
        	$cacheListObj = new CampCacheList($paramsArray, __METHOD__, self::DEFAULT_TTL);
        	$articleCommentsList = $cacheListObj->fetchFromCache();
        	if ($articleCommentsList !== false && is_array($articleCommentsList)) {
        		return $articleCommentsList;
        	}
        }

        $selectClauseObj = new SQLSelectClause();
        $countClauseObj = new SQLSelectClause();

        $messageTable = $PHORUM['message_table'];
        $selectClauseObj->setTable($messageTable);
        $countClauseObj->setTable($messageTable);

        $articleNumber = null;
        $languageId = null;
        // sets the where conditions
        foreach ($p_parameters as $param) {
            $comparisonOperation = self::ProcessListParameters($param);

            if (strtolower($comparisonOperation->getLeftOperand()) == 'fk_article_number') {
                $articleNumber = $comparisonOperation->getRightOperand();
            }
            if (strtolower($comparisonOperation->getLeftOperand()) == 'fk_language_id') {
                $languageId = $comparisonOperation->getRightOperand();
            }
            $parameters[] = $comparisonOperation;
        }

        if (!is_null($articleNumber) && !is_null($languageId)) {
        	// gets the thread id for the article
        	$threadId = ArticleComment::GetCommentThreadId($articleNumber, $languageId);
            $selectClauseObj->addWhere('thread = '.$threadId);
            $countClauseObj->addWhere('thread = '.$threadId);
        }

        $selectClauseObj->addWhere('message_id != thread');
        $selectClauseObj->addWhere('status = '.PHORUM_STATUS_APPROVED);
        $countClauseObj->addWhere('message_id != thread');
        $countClauseObj->addWhere('status = '.PHORUM_STATUS_APPROVED);

        if (!is_array($p_order) || count($p_order) == 0) {
            $p_order = array('default'=>'asc');
        }

        // sets the order condition if any
        if (is_array($p_order)) {
            $order = ArticleComment::ProcessListOrder($p_order);
            // sets the order condition if any
            foreach ($order as $orderDesc) {
                $orderField = $orderDesc['field'];
                $orderDirection = $orderDesc['dir'];
                $selectClauseObj->addOrderBy($orderField . ' ' . $orderDirection);
            }
        }

        // sets the limit
        $selectClauseObj->setLimit($p_start, $p_limit);

        // builds the query and executes it
        $selectQuery = $selectClauseObj->buildQuery();
        $comments = $g_ado_db->GetAll($selectQuery);
        if (is_array($comments)) {
        	$countClauseObj->addColumn('COUNT(*)');
        	$countQuery = $countClauseObj->buildQuery();
        	$p_count = $g_ado_db->GetOne($countQuery);

        	// builds the array of comment objects
        	$articleCommentsList = array();
        	foreach ($comments as $comment) {
        		$pmObj = new Phorum_message($comment['message_id']);
        		if ($pmObj->exists()) {
//.........这里部分代码省略.........
开发者ID:nistormihai,项目名称:Newscoop,代码行数:101,代码来源:ArticleComment.php

示例8: GetListExt


//.........这里部分代码省略.........
                 $mc_mapCons = true;
                 break;
             case 'matchallareas':
                 $mc_areas_matchall = $param->getRightOperand();
                 break;
             case 'matchanyarea':
                 $mc_areas_matchall = !$param->getRightOperand();
                 break;
             case 'exactarea':
                 $mc_areas_exact = $param->getRightOperand();
                 break;
             case 'date':
                 $mc_dates[$param->getOperator()->getName()] = $param->getRightOperand();
                 $mc_mapCons = true;
                 break;
             case 'icon':
                 $mc_icons[] = $param->getRightOperand();
                 $mc_mapCons = true;
                 break;
             default:
                 break;
         }
     }
     // constrained maps ned to have set publication
     if ($mc_mapCons && !$ps_publicationId) {
         return array();
     }
     if (!$ps_languageId || 0 >= $ps_languageId) {
         $ps_languageId = $Context->language->number;
     }
     if (!$ps_languageId || 0 >= $ps_languageId) {
         return array();
     }
     if (!CampCache::IsEnabled()) {
         $p_skipCache = true;
     }
     $ps_orders = array();
     if (!$p_order || !is_array($p_order) || 0 == count($p_order)) {
         if ($mc_mapCons) {
             $ps_orders = array(array('a.Number' => 'DESC'), array('m.id' => 'DESC'));
         }
     } else {
         $allowed_order_dirs = array('DESC' => true, 'ASC' => true);
         foreach ($p_order as $one_order_column => $one_order_dir) {
             $one_dir = strtoupper($one_order_dir);
             if (!array_key_exists($one_dir, $allowed_order_dirs)) {
                 continue;
             }
             switch (strtolower($one_order_column)) {
                 case 'article':
                     if (!$mc_mapCons) {
                         break;
                     }
                     $ps_orders[] = array('a.Number' => $one_dir);
                     break;
                 case 'map':
                     $ps_orders[] = array('m.id' => $one_dir);
                     break;
                 case 'name':
                     $ps_orders[] = array('c.poi_name' => $one_dir);
                     break;
             }
         }
     }
     if ((0 == $ps_mapId || !$ps_mapId) && !$mc_mapCons) {
         return array();
开发者ID:nidzix,项目名称:Newscoop,代码行数:67,代码来源:GeoMapLocation.php

示例9: GetList

 /**
  * Returns an articles list based on the given parameters.
  *
  * @param array   $p_parameters
  *                              An array of ComparisonOperation objects
  * @param string  $p_order
  *                              An array of columns and directions to order by
  * @param integer $p_start
  *                              The record number to start the list
  * @param integer $p_limit
  *                              The offset. How many records from $p_start will be retrieved.
  * @param integer $p_count
  *                              The total count of the elements; this count is computed without
  *                              applying the start ($p_start) and limit parameters ($p_limit)
  *
  * @return array $articlesList
  *               An array of Article objects
  */
 public static function GetList(array $p_parameters, $p_order = null, $p_start = 0, $p_limit = 0, &$p_count, $p_skipCache = false, $returnObjs = true)
 {
     global $g_ado_db;
     if (!$p_skipCache && CampCache::IsEnabled()) {
         $paramsArray['parameters'] = serialize($p_parameters);
         $paramsArray['order'] = is_null($p_order) ? 'null' : $p_order;
         $paramsArray['start'] = $p_start;
         $paramsArray['limit'] = $p_limit;
         $cacheListObj = new CampCacheList($paramsArray, __METHOD__);
         $articlesList = $cacheListObj->fetchFromCache();
         if ($articlesList !== false && is_array($articlesList)) {
             return $articlesList;
         }
     }
     $matchAllTopics = false;
     $hasTopics = array();
     $hasNotTopics = array();
     $selectClauseObj = new SQLSelectClause();
     $otherTables = array();
     // sets the name of the table for the this database object
     $tmpArticle = new Article();
     $articleTable = $tmpArticle->getDbTableName();
     $selectClauseObj->setTable($articleTable);
     unset($tmpArticle);
     $languageId = null;
     $em = Zend_Registry::get('container')->getService('em');
     $request = Zend_Registry::get('container')->getService('request');
     $repository = $em->getRepository('Newscoop\\NewscoopBundle\\Entity\\Topic');
     // parses the given parameters in order to build the WHERE part of
     // the SQL SELECT sentence
     foreach ($p_parameters as $param) {
         $comparisonOperation = self::ProcessListParameters($param, $otherTables);
         $leftOperand = strtolower($comparisonOperation['left']);
         if ($leftOperand == 'idlanguage' && $comparisonOperation['symbol'] == '=') {
             $languageId = $comparisonOperation['right'];
         }
         if (array_key_exists($leftOperand, Article::$s_regularParameters)) {
             // regular article field, having a direct correspondent in the
             // Article table fields
             $whereCondition = Article::$s_regularParameters[$leftOperand] . ' ' . $comparisonOperation['symbol'] . " " . $g_ado_db->escape($comparisonOperation['right']) . " ";
             if ($leftOperand == 'reads' && strstr($comparisonOperation['symbol'], '=') !== false && $comparisonOperation['right'] == 0) {
                 $selectClauseObj->addConditionalWhere($whereCondition);
                 $isNullCond = Article::$s_regularParameters[$leftOperand] . ' IS NULL';
                 $selectClauseObj->addConditionalWhere($isNullCond);
             } elseif ($leftOperand == 'type' && $comparisonOperation['symbol'] == '=') {
                 $selectClauseObj->addConditionalWhere($whereCondition);
             } elseif ($leftOperand == 'workflow_status' && isset($comparisonOperation['pending'])) {
                 $selectClauseObj->addConditionalWhere('Articles.NrIssue = 0');
                 $selectClauseObj->addConditionalWhere('Articles.NrSection = 0');
                 $selectClauseObj->addWhere($whereCondition);
             } else {
                 $selectClauseObj->addWhere($whereCondition);
             }
         } elseif ($leftOperand == 'matchalltopics') {
             // set the matchAllTopics flag
             $matchAllTopics = true;
         } elseif ($leftOperand == 'topic') {
             // add the topic to the list of match/do not match topics depending
             // on the operator
             $topic = $repository->getTopicByIdOrName($comparisonOperation['right'], $request->getLocale())->getOneOrNullResult();
             if ($topic) {
                 $topicIds = array();
                 foreach ($topic->getChildren() as $child) {
                     $topicIds[] = $child->getId();
                 }
                 $topicIds[] = $comparisonOperation['right'];
                 if ($comparisonOperation['symbol'] == '=') {
                     $hasTopics[] = $topicIds;
                 } else {
                     $hasNotTopics[] = $topicIds;
                 }
             }
         } elseif ($leftOperand == 'topic_strict') {
             $topic = $repository->getTopicByIdOrName($comparisonOperation['right'], $request->getLocale())->getOneOrNullResult();
             if ($topic) {
                 $topicIds[] = $comparisonOperation['right'];
                 if ($comparisonOperation['symbol'] == '=') {
                     $hasTopics[] = $topicIds;
                 } else {
                     $hasNotTopics[] = $topicIds;
                 }
             }
//.........这里部分代码省略.........
开发者ID:alvsgithub,项目名称:Newscoop,代码行数:101,代码来源:Article.php

示例10: GetList

 /**
  * Returns an article images list based on the given parameters.
  *
  * @param array $p_parameters
  *    An array of ComparisonOperation objects
  * @param string $p_order
  *    An array of columns and directions to order by
  * @param integer $p_start
  *    The record number to start the list
  * @param integer $p_limit
  *    The offset. How many records from $p_start will be retrieved.
  * @param integer $p_count
  *    The total count of the elements; this count is computed without
  *    applying the start ($p_start) and limit parameters ($p_limit)
  *
  * @return array $articleImagesList
  *    An array of Image objects
  */
 public static function GetList(array $p_parameters, array $p_order = array(), $p_start = 0, $p_limit = 0, &$p_count, $p_skipCache = false)
 {
     global $g_ado_db;
     if (!$p_skipCache && CampCache::IsEnabled()) {
         $paramsArray['parameters'] = serialize($p_parameters);
         $paramsArray['order'] = is_null($p_order) ? 'null' : $p_order;
         $paramsArray['start'] = $p_start;
         $paramsArray['limit'] = $p_limit;
         $cacheListObj = new CampCacheList($paramsArray, __METHOD__);
         $articleImagesList = $cacheListObj->fetchFromCache();
         if ($articleImagesList !== false && is_array($articleImagesList)) {
             return $articleImagesList;
         }
     }
     $hasArticleNr = false;
     $selectClauseObj = new SQLSelectClause();
     $countClauseObj = new SQLSelectClause();
     // sets the where conditions
     foreach ($p_parameters as $param) {
         $comparisonOperation = self::ProcessListParameters($param);
         if (sizeof($comparisonOperation) < 3) {
             break;
         }
         if (strpos($comparisonOperation['left'], 'NrArticle')) {
             $hasArticleNr = true;
         }
         $whereCondition = $g_ado_db->escapeOperation($comparisonOperation);
         $selectClauseObj->addWhere($whereCondition);
         $countClauseObj->addWhere($whereCondition);
     }
     // validates whether article number was given
     if ($hasArticleNr === false) {
         CampTemplate::singleton()->trigger_error('Missing parameter Article ' . 'Number in statement list_article_images');
         return;
     }
     // sets the columns to be fetched
     $tmpImage = new Image();
     $columnNames = $tmpImage->getColumnNames(true);
     foreach ($columnNames as $columnName) {
         $selectClauseObj->addColumn($columnName);
     }
     $countClauseObj->addColumn('COUNT(*)');
     // sets the base table Attachment
     $selectClauseObj->setTable($tmpImage->getDbTableName());
     $countClauseObj->setTable($tmpImage->getDbTableName());
     unset($tmpImage);
     // adds the ArticleImages join and condition to the query
     $selectClauseObj->addTableFrom('ArticleImages');
     $selectClauseObj->addWhere('ArticleImages.IdImage = Images.Id');
     $countClauseObj->addTableFrom('ArticleImages');
     $countClauseObj->addWhere('ArticleImages.IdImage = Images.Id');
     // sets the ORDER BY condition
     $p_order = array_merge($p_order, self::$s_defaultOrder);
     $order = self::ProcessListOrder($p_order);
     foreach ($order as $orderDesc) {
         $orderColumn = $orderDesc['field'];
         $orderDirection = $orderDesc['dir'];
         $selectClauseObj->addOrderBy($orderColumn . ' ' . $orderDirection);
     }
     // sets the limit
     $selectClauseObj->setLimit($p_start, $p_limit);
     // builds the query executes it
     $selectQuery = $selectClauseObj->buildQuery();
     $images = $g_ado_db->GetAll($selectQuery);
     if (is_array($images)) {
         $countQuery = $countClauseObj->buildQuery();
         $p_count = $g_ado_db->GetOne($countQuery);
         // builds the array of image objects
         $articleImagesList = array();
         foreach ($images as $image) {
             $imgObj = new Image($image['Id']);
             if ($imgObj->exists()) {
                 $articleImagesList[] = $imgObj;
             }
         }
     } else {
         $articleImagesList = array();
         $p_count = 0;
     }
     if (!$p_skipCache && CampCache::IsEnabled()) {
         $cacheListObj->storeInCache($articleImagesList);
     }
//.........这里部分代码省略.........
开发者ID:alvsgithub,项目名称:Newscoop,代码行数:101,代码来源:ArticleImage.php

示例11: GetInvalidURLTemplate

 public static function GetInvalidURLTemplate($p_pubId, $p_issNr = NULL, $p_lngId = NULL, $p_isPublished = true)
 {
     global $g_ado_db;
     $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
     if (CampCache::IsEnabled()) {
         $paramString = $p_lngId . '_' . $p_pubId . '_' . $p_issNr;
         $cacheKey = __CLASS__ . '_IssueTemplate_' . $paramString;
         $issueTemplate = CampCache::singleton()->fetch($cacheKey);
         if ($issueTemplate !== false && !empty($issueTemplate)) {
             return $issueTemplate;
         }
     }
     $publication = null;
     if (is_null($p_lngId)) {
         $publication = new Publication($p_pubId);
         if (!$publication->exists()) {
             $template = null;
         }
         $p_lngId = $publication->getLanguageId();
     }
     if (is_null($p_issNr) && (!is_null($publication) || !is_null($p_pubId))) {
         if (is_null($publication)) {
             $publication = new Publication($p_pubId);
         }
         $lastIssue = self::GetLastIssue($publication, $p_lngId, $p_isPublished);
         if (is_null($lastIssue)) {
             $template = null;
         }
         $p_issNr = $lastIssue[0];
     }
     if (!is_null($p_issNr)) {
         $resourceId = new ResourceId('template_engine/classes/CampSystem');
         $outputService = $resourceId->getService(IOutputService::NAME);
         if (!\Zend_Registry::isRegistered('webOutput')) {
             $cacheKeyWebOutput = $cacheService->getCacheKey(array('OutputService', 'Web'), 'outputservice');
             if ($cacheService->contains($cacheKeyWebOutput)) {
                 \Zend_Registry::set('webOutput', $cacheService->fetch($cacheKeyWebOutput));
             } else {
                 $webOutput = $outputService->findByName('Web');
                 $cacheService->save($cacheKeyWebOutput, $webOutput);
                 \Zend_Registry::set('webOutput', $webOutput);
             }
         }
         $templateSearchService = $resourceId->getService(ITemplateSearchService::NAME);
         $issueObj = new Issue($p_pubId, $p_lngId, $p_issNr);
         $template = $templateSearchService->getErrorPage($issueObj->getIssueId(), Zend_Registry::get('webOutput'));
     }
     if (empty($template)) {
         $template = null;
     }
     if (CampCache::IsEnabled()) {
         CampCache::singleton()->store($cacheKey, $template);
     }
     return $template;
 }
开发者ID:alvsgithub,项目名称:Newscoop,代码行数:55,代码来源:CampSystem.php

示例12: storeInCache

	private function storeInCache()
	{
        if (CampCache::IsEnabled()) {
            CampCache::singleton()->store($this->getCacheKey(), $this, $this->m_defaultTTL);
        }
	}
开发者ID:nistormihai,项目名称:Newscoop,代码行数:6,代码来源:ListObject.php

示例13: prepareActionsMenu

 private function prepareActionsMenu($menu)
 {
     $translator = $this->container->get('translator');
     $this->addChild($menu, $translator->trans('Add new article'), array('zend_route' => array('module' => 'admin', 'controller' => 'articles', 'action' => 'add_move.php'), 'resource' => 'article', 'privilege' => 'add'));
     $this->addChild($menu, $translator->trans('publications.title.add', array(), 'pub'), array('uri' => $this->container->get('router')->generate('newscoop_newscoop_publications_add'), 'resource' => 'publication', 'privilege' => 'manage'));
     $this->addChild($menu, $translator->trans('Add new user', array(), 'home'), array('zend_route' => array('module' => 'admin', 'controller' => 'user', 'action' => 'create'), 'resource' => 'user', 'privilege' => 'manage'));
     $this->addChild($menu, $translator->trans('Add new user type', array(), 'home'), array('zend_route' => array('module' => 'admin', 'controller' => 'user-group', 'action' => 'add'), 'resource' => 'user-group', 'privilege' => 'manage'));
     $this->addChild($menu, $translator->trans('Add new article type'), array('zend_route' => array('module' => 'admin', 'controller' => 'article_types', 'action' => 'add.php', 'reset_params' => false), 'resource' => 'article-type', 'privilege' => 'manage'));
     $this->addChild($menu, $translator->trans('Merge article types', array(), 'article_types'), array('zend_route' => array('module' => 'admin', 'controller' => 'article_types', 'action' => 'merge.php', 'reset_params' => false), 'resource' => 'article-type', 'privilege' => 'manage'));
     $status = $this->addChild($menu[$translator->trans('Merge article types', array(), 'article_types')], $translator->trans('Step 2'), array('zend_route' => array('module' => 'admin', 'controller' => 'article_types', 'action' => 'merge2.php', 'reset_params' => false), 'resource' => 'article-type', 'privilege' => 'manage'));
     if ($status) {
         $menu[$translator->trans('Merge article types', array(), 'article_types')][$translator->trans('Step 2', array(), 'article_types')]->setDisplay(false);
     }
     $status = $this->addChild($menu[$translator->trans('Merge article types', array(), 'article_types')], $translator->trans('Step 3', array(), 'article_types'), array('zend_route' => array('module' => 'admin', 'controller' => 'article_types', 'action' => 'merge3.php', 'reset_params' => false), 'resource' => 'article-type', 'privilege' => 'manage'));
     if ($status) {
         $menu[$translator->trans('Merge article types', array(), 'article_types')][$translator->trans('Step 3', array(), 'article_types')]->setDisplay(false);
     }
     if ($this->user->hasPermission('ManageCountries') || $this->user->hasPermission('DeleteCountries')) {
         $status = $this->addChild($menu, $translator->trans('Countries'), array('zend_route' => array('module' => 'admin', 'controller' => 'country', 'action' => 'index.php')));
         if ($status) {
             $menu[$translator->trans('Countries')]->setDisplay(false);
         }
         $this->addChild($menu[$translator->trans('Countries')], $translator->trans('Add new country'), array('zend_route' => array('module' => 'admin', 'controller' => 'country', 'action' => 'add.php'), 'resource' => 'country', 'privilege' => 'manage'));
         $status = $this->addChild($menu[$translator->trans('Countries')], $translator->trans('Edit country'), array('zend_route' => array('module' => 'admin', 'controller' => 'country', 'action' => 'edit.php', 'reset_params' => false), 'resource' => 'country', 'privilege' => 'manage'));
         if ($status) {
             $menu[$translator->trans('Countries')][$translator->trans('Edit country')]->setDisplay(false);
         }
     }
     $this->addChild($menu, $translator->trans('Edit your password', array(), 'home'), array('zend_route' => array('module' => 'admin', 'controller' => 'user', 'action' => 'edit-password')));
     if ($this->user->hasPermission('ManageIssue') && $this->user->hasPermission('AddArticle')) {
         $this->addChild($menu, $translator->trans('Import XML', array(), 'home'), array('zend_route' => array('module' => 'admin', 'controller' => 'articles', 'action' => 'la_import.php')));
     }
     $this->addChild($menu, $translator->trans('Backup/Restore', array(), 'home'), array('zend_route' => array('module' => 'admin', 'controller' => 'backup.php', 'action' => null), 'resource' => 'backup', 'privilege' => 'manage'));
     if (\CampCache::IsEnabled() && $this->user->hasPermission('ClearCache')) {
         $this->addChild($menu, $translator->trans('Clear system cache', array(), 'home'), array('uri' => $this->generateZendRoute('admin') . "/?clear_cache=yes"));
     }
 }
开发者ID:sourcefabric,项目名称:newscoop,代码行数:37,代码来源:Builder.php

示例14: GetTopics

 /**
  * Search the Topics table.
  *
  * @param int $p_id
  * @param int $p_languageId
  * @param string $p_name
  * @param int $p_parentId
  * @param array $p_sqlOptions
  * @return array
  */
 public static function GetTopics($p_id = null, $p_languageId = null, $p_name = null, $p_parentId = null, $p_depth = 1, $p_sqlOptions = null, $p_order = null, $p_countOnly = false, $p_skipCache = false)
 {
     global $g_ado_db;
     if (!$p_skipCache && CampCache::IsEnabled()) {
         $paramsArray['id'] = is_null($p_id) ? '' : $p_id;
         $paramsArray['language_id'] = is_null($p_languageId) ? '' : $p_languageId;
         $paramsArray['name'] = is_null($p_name) ? '' : $p_name;
         $paramsArray['parent_id'] = is_null($p_parentId) ? '' : $p_parentId;
         $paramsArray['depth'] = is_null($p_depth) ? '' : $p_depth;
         $paramsArray['sql_options'] = $p_sqlOptions;
         $paramsArray['order'] = $p_order;
         $paramsArray['count_only'] = (int) $p_countOnly;
         $cacheListObj = new CampCacheList($paramsArray, __METHOD__);
         $topics = $cacheListObj->fetchFromCache();
         if ($topics !== false && is_array($topics)) {
             return $p_countOnly ? $topics['count'] : $topics;
         }
     }
     if (!is_array($p_order) || count($p_order) == 0) {
         $p_order = array(array('field' => 'default', 'dir' => 'asc'));
     }
     foreach ($p_order as $orderCond) {
         switch (strtolower($orderCond['field'])) {
             case 'default':
                 $order['t.node_left'] = $orderCond['dir'];
                 break;
             case 'byname':
                 $order['tn.name'] = $orderCond['dir'];
                 break;
             case 'bynumber':
                 $order['t.id'] = $orderCond['dir'];
                 break;
         }
     }
     $p_sqlOptions['ORDER BY'] = $order;
     $query = new SQLSelectClause();
     $query->addColumn('t.id');
     $topicObj = new Topic();
     $topicNameObj = new TopicName();
     if (!is_null($p_languageId) && is_numeric($p_languageId) || !is_null($p_name) || isset($order['tn.name'])) {
         $query->setTable($topicObj->m_dbTableName . ' AS t LEFT JOIN ' . $topicNameObj->m_dbTableName . ' AS tn ON t.id = tn.fk_topic_id');
     } else {
         $query->setTable($topicObj->m_dbTableName . ' AS t');
     }
     $constraints = array();
     if (!is_null($p_id) && is_numeric($p_id)) {
         $query->addWhere("t.id = '{$p_id}'");
     }
     if (!is_null($p_languageId) && is_numeric($p_languageId)) {
         $query->addWhere("tn.fk_language_id = '{$p_languageId}'");
     }
     if (!is_null($p_name)) {
         $query->addWhere("tn.name = " . $g_ado_db->escape($p_name));
     }
     if (!is_null($p_parentId)) {
         $subtopicsQuery = self::BuildSubtopicsQuery($p_parentId, $p_depth, 1);
         $query->addTableFrom('(' . $subtopicsQuery->buildQuery() . ') AS in_query');
         $query->addWhere("t.id = in_query.id");
     }
     $queryStr = $query->buildQuery();
     $queryStr = DatabaseObject::ProcessOptions($queryStr, $p_sqlOptions);
     if ($p_countOnly) {
         $queryStr = "SELECT COUNT(*) FROM ({$queryStr}) AS topics";
         $topics['count'] = $g_ado_db->GetOne($queryStr);
     } else {
         $topics = array();
         $rows = $g_ado_db->GetAll($queryStr);
         foreach ($rows as $row) {
             $topics[] = new Topic($row['id']);
         }
     }
     if (!$p_skipCache && CampCache::IsEnabled()) {
         $cacheListObj->storeInCache($topics);
     }
     return $topics;
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:86,代码来源:Topic.php

示例15: DeleteCachePluginsInfo

 private static function DeleteCachePluginsInfo()
 {
     if (CampCache::IsEnabled()) {
         $cacheListObj = new CampCacheList(array(), self::CACHE_KEY_PLUGINS_ALL);
         $cacheListObj->deleteFromCache();
         return CampCache::singleton()->delete(self::CACHE_KEY_PLUGINS_LIST);
     }
     return false;
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:9,代码来源:CampPlugin.php


注:本文中的CampCache::IsEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。