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


PHP Feed::selectByPK方法代码示例

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


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

示例1: getBasePath

 public function getBasePath()
 {
     $strReturn = "";
     $objFeed = Feed::selectByPK($this->getFeedId());
     if (is_object($objFeed)) {
         $strReturn = $objFeed->getBasePath();
         $strPath = $this->getFeedPath();
         if (!empty($strPath)) {
             $strPath = "/" . $strPath;
         }
         $strReturn .= $strPath;
     }
     return $strReturn;
 }
开发者ID:laiello,项目名称:punchcms,代码行数:14,代码来源:class.elementfeed.php

示例2: parsePages

function parsePages($intElmntId, $strCommand)
{
    global $objLang, $_CLEAN_POST, $objLiveUser, $_CONF, $_PATHS, $DBAConn, $objMultiUpload;
    $objTpl = new HTML_Template_IT($_PATHS['templates']);
    $blnUiError = Request::get('err', 0);
    switch ($strCommand) {
        case CMD_LIST:
            $objTpl->loadTemplatefile("multiview.tpl.htm");
            $objTpl->setVariable("MAINTITLE", $objLang->get("pcmsElements", "menu"));
            $objElement = Element::selectByPK($intElmntId);
            if (empty($intElmntId)) {
                $strElmntName = "Website";
            } else {
                if (is_object($objElement)) {
                    $strElmntName = $objElement->getName();
                } else {
                    $strElmntName = "";
                }
            }
            if (is_object($objElement) || empty($intElmntId)) {
                if (empty($intElmntId)) {
                    $objElements = Elements::getFromParent(0, false);
                } else {
                    $objElements = $objElement->getElements(false);
                }
                if (is_object($objElements)) {
                    //*** Initiate child element loop.
                    $listCount = 0;
                    $intPosition = request("pos");
                    $intPosition = !empty($intPosition) && is_numeric($intPosition) ? $intPosition : 0;
                    $intPosition = floor($intPosition / $_SESSION["listCount"]) * $_SESSION["listCount"];
                    $objElements->seek($intPosition);
                    //*** Loop through the elements.
                    foreach ($objElements as $objSubElement) {
                        //if (Permissions::hasElementPermission(SPINCMS_ELEMENTS_READ, $objSubElement)) {
                        $objTemplate = Template::selectByPK($objSubElement->getTemplateId(), array('name'));
                        $strMeta = $objLang->get("editedBy", "label") . " " . $objSubElement->getUsername() . ", " . Date::fromMysql($objLang->get("datefmt"), $objSubElement->getModified());
                        $objTpl->setCurrentBlock("multiview-item");
                        if ($objSubElement->getTypeId() != ELM_TYPE_LOCKED) {
                            $objTpl->setVariable("BUTTON_DUPLICATE", $objLang->get("duplicate", "button"));
                            $objTpl->setVariable("BUTTON_DUPLICATE_HREF", "javascript:PElement.duplicate({$objSubElement->getId()});");
                            $objTpl->setVariable("BUTTON_REMOVE", $objLang->get("delete", "button"));
                            $objTpl->setVariable("BUTTON_REMOVE_HREF", "javascript:PElement.remove({$objSubElement->getId()});");
                        }
                        $objTpl->setVariable("MULTIITEM_VALUE", $objSubElement->getId());
                        //if (Permissions::hasElementPermission(SPINCMS_ELEMENTS_WRITE, $objSubElement)) {
                        $objTpl->setVariable("MULTIITEM_HREF", "href=\"?cid=" . NAV_PCMS_ELEMENTS . "&eid={$objSubElement->getId()}&cmd=" . CMD_EDIT . "\"");
                        //} else {
                        //	$objTpl->setVariable("MULTIITEM_HREF", "");
                        //}
                        if ($objSubElement->getActive() < 1) {
                            $objTpl->setVariable("MULTIITEM_ACTIVE", " class=\"inactive\"");
                        }
                        $strValue = htmlspecialchars($objSubElement->getName());
                        $strShortValue = getShortValue($strValue, 50);
                        $intSize = strlen($strValue);
                        $objTpl->setVariable("MULTIITEM_NAME", $intSize > 50 ? $strShortValue : $strValue);
                        $objTpl->setVariable("MULTIITEM_TITLE", $intSize > 50 ? $strValue : "");
                        $strTypeClass = "";
                        if ($objSubElement->getTypeId() == ELM_TYPE_FOLDER) {
                            $strTypeClass = "folder";
                        } else {
                            $objChildElements = $objSubElement->getElements();
                            if (is_object($objChildElements) && $objChildElements->count() > 0) {
                                switch ($objSubElement->getTypeId()) {
                                    case ELM_TYPE_DYNAMIC:
                                        $strTypeClass = "widget-dynamic";
                                        break;
                                    case ELM_TYPE_LOCKED:
                                        $strTypeClass = "widget-locked";
                                        break;
                                    default:
                                        $strTypeClass = "widget";
                                }
                            } else {
                                switch ($objSubElement->getTypeId()) {
                                    case ELM_TYPE_DYNAMIC:
                                        $strTypeClass = "element-dynamic";
                                        break;
                                    case ELM_TYPE_LOCKED:
                                        $strTypeClass = "element-locked";
                                        break;
                                    default:
                                        $strTypeClass = "element";
                                }
                            }
                        }
                        $objTpl->setVariable("MULTIITEM_TYPE_CLASS", $strTypeClass);
                        if (is_object($objTemplate)) {
                            $objTpl->setVariable("MULTIITEM_TYPE", ", " . $objTemplate->getName());
                        }
                        $objTpl->setVariable("MULTIITEM_META", $strMeta);
                        $objTpl->parseCurrentBlock();
                        $listCount++;
                        if ($listCount >= $_SESSION["listCount"]) {
                            break;
                        }
                        //}
                    }
                    //*** Render page navigation.
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:punchcms,代码行数:101,代码来源:inc.tplparse_element.php

示例3: parseFeeds

function parseFeeds($intFeedId, $strCommand)
{
    global $_PATHS, $_CLEAN_POST, $_CONF, $objLang, $objLiveUser;
    $objTpl = new HTML_Template_IT($_PATHS['templates']);
    $objTpl->loadTemplatefile("feed.tpl.htm");
    $blnError = false;
    switch ($strCommand) {
        case CMD_LIST:
        case CMD_ADD:
        case CMD_EDIT:
            //*** Post the profile form if submitted.
            if (count($_CLEAN_POST) > 0 && !empty($_CLEAN_POST['dispatch']) && $_CLEAN_POST['dispatch'] == "editFeed") {
                //*** The element form has been posted.
                //*** Check sanitized input.
                if (is_null($_CLEAN_POST["frm_active"])) {
                    $blnError = true;
                }
                if (is_null($_CLEAN_POST["frm_name"])) {
                    $blnError = true;
                }
                if (is_null($_CLEAN_POST["frm_feed"])) {
                    $blnError = true;
                }
                if (is_null($_CLEAN_POST["frm_basepath"])) {
                    $blnError = true;
                }
                if (is_null($_CLEAN_POST["frm_refresh"])) {
                    $blnError = true;
                }
                if (is_null($_CLEAN_POST["dispatch"])) {
                    $blnError = true;
                }
                if ($blnError === true) {
                    //*** Display global error.
                    $objTpl->setVariable("FORM_ACTIVE_VALUE", $_POST["frm_active"] == "on" ? "checked=\"checked\"" : "");
                    $objTpl->setVariable("FORM_NAME_VALUE", $_POST["frm_name"]);
                    $objTpl->setVariable("FORM_FEED_VALUE", $_POST["frm_feed"]);
                    $objTpl->setVariable("FORM_BASEPATH_VALUE", $_POST["frm_basepath"]);
                    $objTpl->setVariable("FORM_REFRESH_VALUE", $_POST["frm_refresh"]);
                    $objTpl->setVariable("ERROR_FEED_MAIN", $objLang->get("main", "formerror"));
                } else {
                    //*** Input is valid. Save the feed.
                    if ($strCommand == CMD_EDIT) {
                        $objFeed = Feed::selectByPK($intFeedId);
                    } else {
                        $objFeed = new Feed();
                    }
                    $objFeed->setAccountId($_CONF['app']['account']->getId());
                    $objFeed->setActive($_POST["frm_active"] == "on" ? 1 : 0);
                    $objFeed->setName($_CLEAN_POST["frm_name"]);
                    $objFeed->setFeed($_CLEAN_POST["frm_feed"]);
                    $objFeed->setBasepath($_CLEAN_POST["frm_basepath"]);
                    $objFeed->setRefresh($_CLEAN_POST["frm_refresh"]);
                    $objFeed->setLastUpdate(Date::toMysql());
                    $objFeed->save();
                    //*** Cache feed.
                    $objFeed->cache();
                    header("Location: " . Request::getURI() . "/?cid=" . NAV_PCMS_FEEDS);
                    exit;
                }
            }
            //*** Initiate child element loop.
            $objFeeds = Feed::selectSorted();
            $listCount = 0;
            $intPosition = request("pos");
            $intPosition = !empty($intPosition) && is_numeric($intPosition) ? $intPosition : 0;
            $intPosition = floor($intPosition / $_SESSION["listCount"]) * $_SESSION["listCount"];
            $objFeeds->seek($intPosition);
            foreach ($objFeeds as $objFeed) {
                $objTpl->setCurrentBlock("multiview-item");
                $objTpl->setVariable("MULTIITEM_VALUE", $objFeed->getId());
                $objTpl->setVariable("BUTTON_REMOVE_HREF", "javascript:Feed.remove({$objFeed->getId()});");
                $objTpl->setVariable("BUTTON_REMOVE", $objLang->get("delete", "button"));
                $objTpl->setVariable("MULTIITEM_HREF", "?cid=" . NAV_PCMS_FEEDS . "&amp;eid={$objFeed->getId()}&amp;cmd=" . CMD_EDIT);
                $objTpl->setVariable("MULTIITEM_TYPE_CLASS", "feed");
                $objTpl->setVariable("MULTIITEM_NAME", $objFeed->getName());
                $objTpl->setVariable("MULTIITEM_POINTS_TO", $objLang->get("pointsTo", "label"));
                $objTpl->setVariable("MULTIITEM_FEED", $objFeed->getFeed());
                $objTpl->setVariable("MULTIITEM_FEED_HREF", $objFeed->getFeed());
                if (!$objFeed->getActive()) {
                    $objTpl->setVariable("MULTIITEM_ACTIVE", " class=\"inactive\"");
                }
                $objTpl->parseCurrentBlock();
                $listCount++;
                if ($listCount >= $_SESSION["listCount"]) {
                    break;
                }
            }
            //*** Render page navigation.
            $pageCount = ceil($objFeeds->count() / $_SESSION["listCount"]);
            if ($pageCount > 0) {
                $currentPage = ceil(($intPosition + 1) / $_SESSION["listCount"]);
                $previousPos = $intPosition - $_SESSION["listCount"] > 0 ? $intPosition - $_SESSION["listCount"] : 0;
                $nextPos = $intPosition + $_SESSION["listCount"] < $objFeeds->count() ? $intPosition + $_SESSION["listCount"] : $intPosition;
                $objTpl->setVariable("PAGENAV_PAGE", sprintf($objLang->get("pageNavigation", "label"), $currentPage, $pageCount));
                $objTpl->setVariable("PAGENAV_PREVIOUS", $objLang->get("previous", "button"));
                $objTpl->setVariable("PAGENAV_PREVIOUS_HREF", "?cid=" . NAV_PCMS_FEEDS . "&amp;pos={$previousPos}");
                $objTpl->setVariable("PAGENAV_NEXT", $objLang->get("next", "button"));
                $objTpl->setVariable("PAGENAV_NEXT_HREF", "?cid=" . NAV_PCMS_FEEDS . "&amp;pos={$nextPos}");
                //*** Top page navigation.
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:punchcms,代码行数:101,代码来源:inc.tplparse_feeds.php


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