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


PHP Author::ReadName方法代码示例

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


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

示例1: 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)
    {
        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;

        // 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);
                } 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 = new Topic($comparisonOperation['right']);
                if ($topic->exists()) {
                    $topicIds = $topic->getSubtopics(true, 0);
                    $topicIds[] = $comparisonOperation['right'];
                    if ($comparisonOperation['symbol'] == '=') {
                        $hasTopics[] = $topicIds;
                    } else {
                        $hasNotTopics[] = $topicIds;
                    }
                }
            } elseif ($leftOperand == 'author') {
                $otherTables['ArticleAuthors'] = array('__JOIN' => ',');
                $author = Author::ReadName($comparisonOperation['right']);
                $symbol = $comparisonOperation['symbol'];
                $valModifier = strtolower($symbol) == 'like' ? '%' : '';

                $firstName = $g_ado_db->escape($author['first_name']);
                $lastName = $g_ado_db->escape($author['last_name']);
//.........这里部分代码省略.........
开发者ID:nistormihai,项目名称:Newscoop,代码行数:101,代码来源:Article.php

示例2: setName

 /**
  * @param string $p_name
  * @return bool
  */
 public function setName($p_name)
 {
     $name = Author::ReadName($p_name);
     return $this->setLastName($name['last_name']) && $this->setFirstName($name['first_name']);
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:9,代码来源:Author.php

示例3: GetList


//.........这里部分代码省略.........
                 $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;
                 }
             }
         } elseif ($leftOperand == 'author') {
             $otherTables['ArticleAuthors'] = array('__JOIN' => ',');
             $author = Author::ReadName($comparisonOperation['right']);
             $symbol = $comparisonOperation['symbol'];
             $valModifier = strtolower($symbol) == 'like' ? '%' : '';
             $firstName = trim(trim($g_ado_db->escape($author['first_name']), "'"));
             $lastName = trim(trim($g_ado_db->escape($author['last_name']), "'"));
             $authors = $g_ado_db->GetAll("\n                    SELECT Authors.id\n                    FROM Authors\n                    WHERE CONCAT(Authors.first_name, ' ', Authors.last_name) {$symbol}\n                         '{$valModifier}{$firstName} {$lastName}{$valModifier}'\n                ");
             $authorsIds = array();
             foreach ($authors as $author) {
                 $authorsIds[] = $author['id'];
             }
             $whereCondition = "ArticleAuthors.fk_author_id IN (" . implode(',', $authorsIds) . ")";
             $selectClauseObj->addWhere($whereCondition);
             $selectClauseObj->addWhere('Articles.Number = ArticleAuthors.fk_article_number');
             $selectClauseObj->addWhere('Articles.IdLanguage = ArticleAuthors.fk_language_id');
         } elseif ($leftOperand == 'search_phrase') {
             $searchQuery = ArticleIndex::SearchQuery($comparisonOperation['right'], $comparisonOperation['symbol']);
             if (!empty($searchQuery)) {
                 $otherTables["({$searchQuery})"] = array('__TABLE_ALIAS' => 'search', '__JOIN' => 'INNER JOIN', 'Number' => 'NrArticle', 'IdLanguage' => 'IdLanguage');
             }
         } elseif ($leftOperand == 'location') {
             $num = '[-+]?[0-9]+(?:\\.[0-9]+)?';
             if (preg_match("/({$num}) ({$num}), ({$num}) ({$num})/", trim($comparisonOperation['right']), $matches)) {
                 $queryLocation = Geo_Map::GetGeoSearchSQLQuery(array(array('latitude' => $matches[1], 'longitude' => $matches[2]), array('latitude' => $matches[3], 'longitude' => $matches[4])));
                 $selectClauseObj->addWhere("Articles.Number IN ({$queryLocation})");
             }
         } elseif ($leftOperand == 'insection') {
             $selectClauseObj->addWhere("Articles.NrSection IN " . $comparisonOperation['right']);
         } elseif ($leftOperand == 'complex_date') {
             /* @var $param ComparisonOperation */
             $fieldName = key($roper = $param->getRightOperand());
             $searchValues = array();
             foreach (explode(",", current($roper)) as $values) {
                 list($key, $value) = explode(":", $values, 2);
开发者ID:alvsgithub,项目名称:Newscoop,代码行数:67,代码来源:Article.php

示例4: foreach

 $language = $em->getRepository('Newscoop\\Entity\\Language')->findOneById($articleObj->getLanguageId());
 $authors = $em->getRepository('Newscoop\\Entity\\ArticleAuthor')->getArticleAuthors($articleObj->getArticleNumber(), $language->getCode())->getArrayResult();
 ArticleAuthor::OnArticleLanguageDelete($articleObj->getArticleNumber(), $articleObj->getLanguageId());
 foreach ($authors as $author) {
     $dispatcher->dispatch("user.set_points", new \Newscoop\EventDispatcher\Events\GenericEvent($this, array('authorId' => $author['fk_author_id'])));
 }
 $i = 0;
 foreach ($f_article_author as $author) {
     $authorObj = new Author($author);
     $author = trim($author);
     if (!$authorObj->exists() && isset($author[0])) {
         if ($blogService->isBlogger($g_user)) {
             // blogger can't create authors
             continue;
         }
         $authorData = Author::ReadName($author);
         $authorObj->create($authorData);
     } elseif ($blogService->isBlogger($g_user)) {
         // test if using authors from blog
         if (!$blogService->isBlogAuthor($authorObj, $blogInfo)) {
             continue;
         }
     }
     // Sets the author type selected
     $author_type = $f_article_author_type[$i];
     $authorObj->setType($author_type);
     // Links the author to the article
     if ($authorObj->getId() != 0) {
         $articleAuthorObj = new ArticleAuthor($articleObj->getArticleNumber(), $articleObj->getLanguageId(), $authorObj->getId(), $author_type, $i + 1);
     }
     if (isset($articleAuthorObj) && !$articleAuthorObj->exists()) {
开发者ID:alvsgithub,项目名称:Newscoop,代码行数:31,代码来源:post.php

示例5: array_pop

$conflictingArticles = Article::GetByName($f_article_name, $publication_id, $issue_number, $section_number, null, true);
if (count($conflictingArticles) > 0) {
    $conflictingArticle = array_pop($conflictingArticles);
    $conflictingArticleLink = camp_html_article_url($conflictingArticle, $conflictingArticle->getLanguageId(), 'edit.php');
    camp_html_add_msg(getGS("You cannot have two articles in the same section with the same name.  The article name you specified is already in use by the article '\$1'.", "<a href='{$conflictingArticleLink}'>" . $conflictingArticle->getName() . "</a>"));
    camp_html_goto_page($backLink);
} else {
    $articleObj->create($f_article_type, $f_article_name, $publication_id, $issue_number, $section_number);
}
if ($articleObj->exists()) {
    $author = $this->_helper->service('user')->getCurrentUser()->getAuthorId();
    if (empty($author)) {
        $articleObj->setCreatorId($g_user->getUserId());
        $authorObj = new Author($g_user->getRealName());
        if (!$authorObj->exists()) {
            $authorData = Author::ReadName($g_user->getRealName());
            $authorData['email'] = $g_user->getEmail();
            $authorObj->create($authorData);
        }
    } else {
        $authorObj = new Author($author);
    }
    if ($authorObj->exists()) {
        $articleObj->setAuthor($authorObj);
    }
    $articleObj->setIsPublic(true);
    if ($publication_id > 0) {
        $commentDefault = $publicationObj->commentsArticleDefaultEnabled();
        $articleObj->setCommentsEnabled($commentDefault);
    }
    camp_html_add_msg(getGS("Article created."), "ok");
开发者ID:nidzix,项目名称:Newscoop,代码行数:31,代码来源:do_add.php


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