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


PHP Article::setId方法代码示例

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


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

示例1: getArticleDetail

 public function getArticleDetail($id)
 {
     $sqlHelper = new SqlHelper();
     $article = new Article();
     $sql = "select * from lavender_article where id={$id}";
     $res = $sqlHelper->dql_arr($sql);
     $article->setId($res[0]['id']);
     $article->setPraise($res[0]['praise']);
     $article->setContent($res[0]['content']);
     $article->setDate($res[0]['date']);
     $article->setReadTime($res[0]['read_time']);
     $article->setImg($res[0]['img']);
     $article->setNoPraise($res[0]['no_praise']);
     $article->setTitle($res[0]['title']);
     return $article;
 }
开发者ID:justfu,项目名称:lavender,代码行数:16,代码来源:ArticleService.class.php

示例2: choix

 public function choix()
 {
     $requete = $this->_db->prepare('select id , nom from article');
     $requete->execute(array());
     $results = $requete->fetchAll();
     $tabobject = array();
     if (empty($results)) {
         return false;
     }
     foreach ($results as $result) {
         $monarticle = new Article();
         $monarticle->setId($result['id'])->setNom($result['nom']);
         array_push($tabobject, $monarticle);
         // Push l'objet $article dans le tableau $tabobject
     }
     return $tabobject;
 }
开发者ID:FMagnoux,项目名称:Catalogue,代码行数:17,代码来源:CommentManager.php

示例3: retour_article_one

 public function retour_article_one($idarticle)
 {
     $requete = $this->_db->prepare('select * from article where id=:id');
     $requete->execute(array(':id' => $idarticle));
     $results = $requete->fetchAll();
     $tabobject = array();
     if (empty($results)) {
         return false;
     }
     foreach ($results as $result) {
         $monarticle = new Article();
         $monarticle->setId($result['id'])->setNom($result['nom'])->setPoints($result['points'])->setMarque($result['marque'])->setDescription($result['description'])->setImg($result['img']);
         array_push($tabobject, $monarticle);
         // Push l'objet $article dans le tableau $tabobject
     }
     return $tabobject;
 }
开发者ID:FMagnoux,项目名称:Catalogue,代码行数:17,代码来源:ArticleManager.php

示例4: fromXML

 /**
  * Create an Article object from XML
  *
  * @param SimpleXMLElement $xml simpleXML element containing a single article XML
  *
  * @static
  *
  * @return phpOpenNOS\Model\Article
  */
 public static function fromXML(\SimpleXMLElement $xml)
 {
     $article = new Article();
     $article->setId((int) $xml->id);
     $article->setTitle((string) $xml->title);
     $article->setDescription((string) $xml->description);
     $article->setPublished((string) $xml->published);
     $article->setLastUpdate((string) $xml->last_update);
     $article->setThumbnailXS((string) $xml->thumbnail_xs);
     $article->setThumbnailS((string) $xml->thumbnail_s);
     $article->setThumbnailM((string) $xml->thumbnail_m);
     $article->setLink((string) $xml->link);
     $keywords = array();
     foreach ($xml->keywords->keyword as $keyword) {
         $keywords[] = (string) $keyword;
     }
     $article->setKeywords($keywords);
     return $article;
 }
开发者ID:ingewikkeld,项目名称:phpopennos,代码行数:28,代码来源:Article.php

示例5: CategoryDao

<?php

include_once 'data/CategoryDAO.php';
include_once 'control/ArticleControls.php';
include_once 'business/Article.php';
$categoryDao = new CategoryDao();
$articleController = new ArticleControls();
$article = new Article();
$article->setName($_POST['title']);
$article->setId(intval($_POST['id']));
$article->setContent($_POST['editor']);
$article->setSumup($_POST['sumup_editor']);
$article->setTags($_POST['tags']);
$ret = $articleController->alterArticle($article);
if ($ret) {
    header("location:../news.php?art_id=" . $_POST['id']);
} else {
    echo "Unexpected exception";
}
开发者ID:laiello,项目名称:site-web-php,代码行数:19,代码来源:updateArticle.php

示例6: Articles

 function _addPost($data, $_debug)
 {
     if ($data["title"] == NULL) {
         $data["title"] = "No Title Entered.";
     }
     if ($data["text"] == NULL) {
         $data["text"] = "No Body Entered.";
     }
     if ($data["category"] == NULL) {
         $data["category"] = 1;
     }
     if ($data["user_id"] == NULL) {
         $data["user_id"] = 1;
     }
     if ($data["blog_id"] == NULL) {
         $data["blog_id"] = 1;
     }
     if ($data["status"] == NULL) {
         $data["status"] = POST_STATUS_PUBLISHED;
     }
     if ($data["comments"] == NULL) {
         $data["comments"] = true;
     }
     $articles = new Articles();
     // verify that article does not exist in database
     $artss = $articles->getBlogArticles($data["blog_id"]);
     $exists = 0;
     foreach ($artss as $art) {
         if ($art->getTopic() == $data["title"]) {
             $exists = $art->getId();
             break;
         }
     }
     /*
     $exists = $articles->getBlogArticleByTitle( 
     			TextFilter::urlize($data["title"]) ,
     			$data["blog_id"], 
     			true, -1 -1 -1, POST_STATUS_PUBLISHED );
     
     if (!$exists) 
     {
     	$exists = $articles->getBlogArticleByTitle( 
     			TextFilter::urlize($data["title"]) ,
     			$data["blog_id"], 
     			true, -1 -1 -1, POST_STATUS_DRAFT );
     }
     */
     if (!$exists) {
         // verify that desired post id does not exist.  Otherwise, create new id.
         if (!$articles->getUserArticle($data["id"])) {
             $post_id = $data["id"];
         }
         if ($_debug) {
             print "--- --- adding post " . $data["title"] . " to db.<br />\n\r";
         }
         $cat[0] = $data["category"];
         $article = new Article($data["title"], $data["text"], $cat, $data["user_id"], $data["blog_id"], $data["status"], 0);
         if ($data["date"]) {
             $article->setDate($data["date"]);
         }
         if ($post_id) {
             $article->setId($post_id);
         }
         $article->setCommentsEnabled($data["comments"]);
         $artId = $articles->addArticle($article);
         $this->_stats["posts"]["write"]++;
         // remap comments to $artId
         if ($this->_container["comments"]) {
             foreach ($this->_t_container["comments"] as $comment => $val) {
                 if ($this->container["comments"][$comment]["article_id"] == $data["id"] || $val["article_id"] == NULL) {
                     $this->_container["comments"][$comment]["article_id"] = $artId;
                     if ($_debug) {
                         print "--- --- remapping comment entry #" . $comment . " to proper article id<br />\n\r";
                     }
                 }
             }
         }
     } else {
         $artId = $exists;
         if ($_debug) {
             print "--- --- post already exists, aborting operation.<br />\n\r";
         }
     }
     return $artId;
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:85,代码来源:portobject.class.php

示例7: callbackGetArticle

 /**
  * Callback dealing with ArticleDAO::getArticle()
  * calls via our mock ArticleDAO.
  *
  * @see ArticleDAO::getArticle()
  */
 public function callbackGetArticle($articleId, $journalId = null, $useCache = false)
 {
     // Create an article instance with the correct id.
     $article = new Article();
     $article->setId($articleId);
     return $article;
 }
开发者ID:jalperin,项目名称:ojs,代码行数:13,代码来源:ArticleSearchTest.php

示例8: fromJson

 public static function fromJson($json)
 {
     $article = new Article();
     return $article->setId($json->Id)->setSlug($json->Slug)->setTitle($json->Title)->setSubtitle($json->SubTitle)->setTextFormatted($json->TextFormatted)->setCreatedOn(new \DateTime($json->CreatedOn))->setLastModificationDate(new \DateTime($json->LastModificationDate))->setRedactor(Person::fromJson($json->Redactor))->setCategory(Category::fromJson($json->Category));
 }
开发者ID:chteuchteu,项目名称:Too-Much-Information,代码行数:5,代码来源:Article.php

示例9: perform

 function perform()
 {
     $status = POST_STATUS_DRAFT;
     $articles = new Articles();
     $postText = Textfilter::xhtmlize($this->_postText) . POST_EXTENDED_TEXT_MODIFIER . Textfilter::xhtmlize($this->_postExtendedText);
     $article = new Article($this->_postTopic, $postText, $this->_postCategories, $this->_userInfo->getId(), $this->_blogInfo->getId(), $status, 0, array(), $this->_postSlug);
     // set also the date before it's too late
     $article->setDateObject($this->_postTimestamp);
     $article->setCommentsEnabled($this->_commentsEnabled);
     // prepare the custom fields
     $fields = array();
     if (is_array($this->_customFields)) {
         foreach ($this->_customFields as $fieldId => $fieldValue) {
             // 3 of those parameters are not really need when creating a new object... it's enough that
             // we know the field definition id.
             $customField = new CustomFieldValue($fieldId, $fieldValue, "", -1, "", $artId, $this->_blogInfo->getId(), -1);
             array_push($fields, $customField);
         }
         $article->setFields($fields);
     }
     // in case the post is already in the db
     if ($this->_postId != "") {
         $article->setId($this->_postId);
         $postSavedOk = $articles->updateArticle($article);
         if ($postSavedOk) {
             $artId = $this->_postId;
         } else {
             $artId = false;
         }
     } else {
         $artId = $articles->addArticle($article);
     }
     // once we have built the object, we can add it to the database
     $this->_view = new AdminXmlView($this->_blogInfo, "response");
     $this->_view->setValue("method", "saveXmlDraft");
     if ($artId) {
         $this->_view->setValue("result", $artId);
     } else {
         $this->_view->setValue("result", "0");
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:42,代码来源:adminxmlsavedraftaction.class.php

示例10: execute

 /**
  * Save settings.
  */
 function execute($editArticleId)
 {
     $this->editArticleID = $editArticleId;
     $articleDao =& DAORegistry::getDAO('ArticleDAO');
     $signoffDao =& DAORegistry::getDAO('SignoffDAO');
     $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
     $application =& PKPApplication::getApplication();
     $request =& $application->getRequest();
     $user =& $request->getUser();
     $router =& $request->getRouter();
     $journal =& $router->getContext($request);
     $article = new Article();
     $article->setLocale($journal->getPrimaryLocale());
     // FIXME in bug #5543
     $article->setUserId($user->getId());
     $article->setJournalId($journal->getId());
     $article->setSectionId($this->getData('sectionId'));
     $article->setLanguage(String::substr($journal->getPrimaryLocale(), 0, 2));
     $article->setTitle($this->getData('title'), null);
     // Localized
     //add Original Journal to Abstract
     $orig_journal = $this->getData('originalJournal');
     $abstr = $this->getData('abstract');
     foreach (array_keys($abstr) as $abs_key) {
         $abstr[$abs_key] .= '  <p id="originalPub"> ' . $orig_journal . ' </p> ';
         //		$abstr[$abs_key] .=  '  <p id="originalPub"> ' . $orig_journal[$abs_key]. ' </p> ';
         //OriginalJournal in EditPlugin only a string and not an array...
         $this->setData('abstract', $abstr);
     }
     $article->setAbstract($this->getData('abstract'), null);
     // Localized
     $article->setDiscipline($this->getData('discipline'), null);
     // Localized
     $article->setSubjectClass($this->getData('subjectClass'), null);
     // Localized
     $article->setSubject($this->getData('subject'), null);
     // Localized
     $article->setCoverageGeo($this->getData('coverageGeo'), null);
     // Localized
     $article->setCoverageChron($this->getData('coverageChron'), null);
     // Localized
     $article->setCoverageSample($this->getData('coverageSample'), null);
     // Localized
     $article->setType($this->getData('type'), null);
     // Localized
     $article->setSponsor($this->getData('sponsor'), null);
     // Localized
     $article->setCitations($this->getData('citations'));
     $article->setPages($this->getData('pages'));
     // Set some default values so the ArticleDAO doesn't complain when adding this article
     $article->setDateSubmitted(Core::getCurrentDate());
     $article->setStatus(STATUS_PUBLISHED);
     $article->setSubmissionProgress(0);
     $article->stampStatusModified();
     $article->setCurrentRound(1);
     $article->setFastTracked(1);
     $article->setHideAuthor(0);
     $article->setCommentsStatus(0);
     // As article has an ID already set it
     $article->setId($this->editArticleID);
     $articleId = $this->editArticleID;
     //delete prior Authors to prevent from double saving the same authors
     $authorDao =& DAORegistry::getDAO('AuthorDAO');
     $authorDao->deleteAuthorsByArticle($articleId);
     // Add authors
     $authors = $this->getData('authors');
     for ($i = 0, $count = count($authors); $i < $count; $i++) {
         if ($authors[$i]['authorId'] > 0) {
             // Update an existing author
             $author =& $article->getAuthor($authors[$i]['authorId']);
             $isExistingAuthor = true;
         } else {
             // Create a new author
             $author = new Author();
             $isExistingAuthor = false;
         }
         if ($author != null) {
             $author->setSubmissionId($articleId);
             $author->setFirstName($authors[$i]['firstName']);
             $author->setMiddleName($authors[$i]['middleName']);
             $author->setLastName($authors[$i]['lastName']);
             if (array_key_exists('affiliation', $authors[$i])) {
                 $author->setAffiliation($authors[$i]['affiliation'], null);
             }
             $author->setCountry($authors[$i]['country']);
             $author->setEmail($authors[$i]['email']);
             $author->setUrl($authors[$i]['url']);
             if (array_key_exists('competingInterests', $authors[$i])) {
                 $author->setCompetingInterests($authors[$i]['competingInterests'], null);
             }
             $author->setBiography($authors[$i]['biography'], null);
             $author->setPrimaryContact($this->getData('primaryContact') == $i ? 1 : 0);
             $author->setSequence($authors[$i]['seq']);
             if ($isExistingAuthor == false) {
                 $article->addAuthor($author);
             }
         }
//.........这里部分代码省略.........
开发者ID:ingmarschuster,项目名称:MindResearchRepository,代码行数:101,代码来源:PaperPackageEdForm.inc.php

示例11: Article

<?php

/**
 * Created by PhpStorm.
 * User: Florent
 * Date: 17/04/2015
 * Time: 10:48
 */
require_once '../Navbar/navbar.php';
require_once '../Database/pdo.php';
require_once '../Entity/Article.php';
require_once '../EntityManager/ArticleManager.php';
$monarticle = new Article();
$monarticle->setId($_POST['id'])->setTypeid($_POST['type'])->setNom($_POST['nom'])->setMarque($_POST['marque'])->setPoints($_POST['points'])->setDescription($_POST['description']);
$monmanagerarticle = new ArticleManager($bdd);
$monmanagerarticle->modification($monarticle);
header('Location:../Main/article.php');
开发者ID:FMagnoux,项目名称:BackOfficeCatalogue,代码行数:17,代码来源:article_update_cible.php

示例12: array

            <?php 
include 'header.php';
?>
        </header>
        <section>
            <div class="row">
                <div class="col-sm-6 col-sm-offset-3">
            <?php 
if (htmlentities(addslashes(isset($_POST['id'])))) {
    $news = $controleur->getNewsId($_POST['id']);
    echo "<form method='POST' action='updateNews.php'>\n                        <fieldset>\n                            <legend>Form update news</legend>\n                            <input type='hidden' id='id' name='id' value='" . $_POST['id'] . "'/>\n                            <label class='col-sm-4' for='title'>Title: </label>\n                            <input class='col-sm-8' type='text' id='title' name='title' value='" . $news->getTitle() . "' maxlength='100'/>\n                            <label class='col-sm-4' for='abstract'>Abstract: </label>\n                            <textarea class='col-sm-8' id='abstract' name='abstract'>" . $news->getAbstractNews() . "</textarea>\n                            <label class='col-sm-4' for='content'>Content: </label>\n                            <textarea class='col-sm-8' id='content' name='content'>" . $news->getContent() . "</textarea>\n                            <input type='hidden' id='datecreated' name='datecreated' value='" . $news->getDateCreated() . "'/>\n                            <input class='col-sm-8 col-sm-offset-4 btn btn-primary' type='submit' name='btnupdatenews' value='UPDATE'/>\n                        </fieldset>                                                                     </form>";
} else {
    if (isset($_POST['btnupdatenews'])) {
        $image = array();
        //TEMP
        $controleur = new Controleur();
        $news = new Article(htmlentities(addslashes($_POST['title'])), htmlentities(addslashes($_POST['abstract'])), htmlentities(addslashes($_POST['content'])), htmlentities(addslashes($_POST['datecreated'])), date("Y-m-d"), $image);
        $news->setId($_POST['id']);
        $controleur->updateNews($news);
        header('Location: news.php');
    } else {
        header('Location:home.php');
    }
}
?>
                </div>
            </div>
        </section>
         <script                                                 src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>          
    </body>
</html>
开发者ID:hbenji,项目名称:Web,代码行数:31,代码来源:updateNews.php

示例13: addArticle

 public function addArticle($title, $textId)
 {
     $article = new Article($this->addSubElement("article"));
     $article->setId($this->getId() . "_article_" . $this->getNewArticleId());
     $article->setTitle($title);
     $article->setText($textId);
     $this->saveDOM();
     return $article;
 }
开发者ID:jacomyma,项目名称:GEXF-Atlas,代码行数:9,代码来源:engine.php

示例14: testSetIdWithParamIsString

 /**
  * When string is passed to setId it throws InvalidArgumetException
  *
  * @expectedException InvalidArgumentException
  */
 public function testSetIdWithParamIsString()
 {
     $article = new Article();
     $article->setId('lala');
 }
开发者ID:kruppi,项目名称:zfblog,代码行数:10,代码来源:ArticleTest.php


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