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


PHP article::getId方法代码示例

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


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

示例1: date

 * 负责处理新发表文章的逻辑
 * Createed By C860 at 2014-1-19
 */
if (!class_exists('sys')) {
    include_once '../conf/config.php';
}
//需要登录
sys::needLog('../login.php');
//检测数据合法性
if (isset($_POST['title']) && !empty($_POST['title']) && isset($_POST['content']) && !empty($_POST['content']) && isset($_POST['tags']) && !empty($_POST['tags'])) {
    //引入相关模型类
    include_once '../Models/article.php';
    include_once '../Models/tag_relate_article.php';
    include_once '../Models/user_info.php';
    $currentTime = date('Y-m-d H:i:s');
    //新增文章
    if (article::add($_POST['title'], $_POST['content'], $currentTime, $_SESSION['userId'])) {
        $ID = article::getId($_POST['title'], $_SESSION['userId'], $currentTime);
        $tags = explode('|', $_POST['tags']);
        foreach ($tags as $tag) {
            tag_relate_article::add($tag, $ID);
        }
        user_info::increaseArticleCount($_SESSION['userId']);
        sys::alert('发表成功!');
        sys::redirect('../index.php');
    }
} else {
    //引入相关模型类
    include_once 'Models/tag.php';
    $taglist = tag::getAllTags();
}
开发者ID:dalinhuang,项目名称:HCI-MSGsystem,代码行数:31,代码来源:newArticle.php

示例2: showArticleAdministration

function showArticleAdministration()
{
    require_once ROOT . "includes/items.php";
    require_once ROOT . "DBInterface/articleDB.php";
    require_once ROOT . "DBInterface/languageDB.php";
    require_once ROOT . "DBInterface/articleTranslationDB.php";
    if (isset($_POST['action'])) {
        if ($_POST['action'] == 'add') {
            $articleDB = new ArticleDB();
            $res = $articleDB->addArticle($_POST['artSystemName'], $_POST['artSystemDescription'], $_POST['artPrice'], $_POST['artImagePath']);
            $resID = $res->fetch_object();
            $artID = $resID->Article_ID;
            saveCategory($artID);
            saveLanguages($artID);
        } else {
            if ($_POST['action'] == 'update') {
                $articleDB = new ArticleDB();
                $artID = $_POST['artId'];
                $res = $articleDB->updateArticle($_POST['artId'], $_POST['artSystemName'], $_POST['artSystemDescription'], $_POST['artPrice'], $_POST['artImagePath']);
                saveCategory($artID);
                saveLanguages($artID);
            } else {
                if ($_POST['action'] == 'delete') {
                    $artID = $_POST['artId'];
                    deleteArticle($artID);
                }
            }
        }
    }
    $lang = $_COOKIE["lang"];
    include ROOT . "resources/{$lang}.php";
    $items = array();
    $article = null;
    $articleDB = new ArticleDB();
    echo "<table  class=\"basket-table\" border=\"1px\">";
    echo "<thead>";
    echo "<tr>";
    echo "<th>{$adminArticleId}</th>";
    echo "<th>{$adminArticleName}</th>";
    echo "<th>{$adminArticleDescription}</th>";
    echo "<th>{$adminArticlePrice}</th>";
    echo "<th>{$adminArticleImage}</th>";
    echo "<th>&nbsp;</th>";
    echo "<th>&nbsp;</th>";
    echo "</tr>";
    echo "</thead>";
    echo "<tbody>";
    $res = $articleDB->getAllArticles();
    while ($items = $res->fetch_object()) {
        $articleId = $items->Article_ID;
        $articleName = $items->ArticleName;
        $articleDescription = $items->ArticleDescription;
        $articlePrice = $items->ArticlePrice;
        $articleImage = $items->ArticleImage;
        $article = new article($articleId, $articleName, $articlePrice, $articleDescription, $articleImage, null);
        echo "<tr>";
        echo "<td>" . $article->getId() . "</td>";
        echo "<td>" . $article->getName() . "</td>";
        echo "<td>" . $article->getDescription() . "</td>";
        echo "<td>" . $article->getPrice() . "</td>";
        echo "<td>" . $article->getImage() . "</td>";
        echo "<form action=\"index.php?site=changeArticle\" method=\"get\">";
        echo "<input type=\"hidden\" name=\"artId\" value=\"" . $article->getId() . "\" /input>";
        echo "<input type=\"hidden\" name=\"site\" value=\"changeArticle\" /input>";
        echo "<input type=\"hidden\" name=\"origin\" value=\"update\" /input>";
        echo "<td> <input class=\"basket-update-button\" type=\"submit\" value=\"{$adminArticleUpdateLabel}\"/></td>";
        echo "</form>";
        echo "<form action=\"index.php?" . $_SERVER['QUERY_STRING'] . "\" method=\"post\">";
        echo "<input type=\"hidden\" name=\"artId\" value=\"" . $article->getId() . "\" /input>";
        echo "<input type=\"hidden\" name=\"action\" value=\"delete\" /input>";
        echo "<td> <input class=\"basket-delete-button\" name=\"delete\" type=\"submit\" value=\"{$adminArticleDeleteLabel}\"/></td>";
        echo "</form>";
        echo "</tr>";
        echo "</form>";
    }
    // last line to add a new article
    echo "<form action=\"index.php?site=changeArticle\" method=\"get\">";
    // echo "<input type=\"hidden\" name=\"articleId\" value=\"" . $articleId . "\" /input>";
    echo "<tr>";
    echo "<td></td>";
    echo "<td></td>";
    echo "<td></td>";
    echo "<td></td>";
    echo "<td></td>";
    echo "<td></td>";
    echo "<input type=\"hidden\" name=\"site\" value=\"changeArticle\" /input>";
    echo "<input type=\"hidden\" name=\"origin\" value=\"add\" /input>";
    echo "<td> <input class=\"basket-update-button\"  type=\"submit\" value=\"{$adminArticleAddLabel}\"/></td>";
    echo "</tr>";
    echo "</form>";
    echo "</tbody>";
    echo "</table>";
}
开发者ID:nellen,项目名称:ch.bfh.bti7054.w2014.q.Web-Prophecies,代码行数:93,代码来源:administration.php


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