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


PHP PageType::GetByPageTypeUniqId方法代码示例

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


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

示例1: add

 /**
  * @method POST
  */
 function add()
 {
     // get an authuser
     $authUser = new AuthUser();
     if (isset($authUser->UserUniqId)) {
         // check if authorized
         parse_str($this->request->data, $request);
         // parse request
         // get the page type (if applicable)
         $pageTypeId = -1;
         $pageTypeUniqId = $request['pageTypeUniqId'];
         // get page type
         // check permissions
         if (Utilities::CanPerformAction($pageTypeUniqId, $authUser->CanCreate) == false) {
             return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
         }
         // default layout and stylesheet is content
         $layout = 'content';
         $stylesheet = 'content';
         if ($pageTypeUniqId != '-1') {
             $pageType = PageType::GetByPageTypeUniqId($pageTypeUniqId);
             if ($pageType != null) {
                 $pageTypeId = $pageType['PageTypeId'];
                 $layout = $pageType['Layout'];
                 $stylesheet = $pageType['Stylesheet'];
             }
         }
         $name = $request['name'];
         $friendlyId = $request['friendlyId'];
         $description = $request['description'];
         $page = Page::Add($friendlyId, $name, $description, $layout, $stylesheet, $pageTypeId, $authUser->SiteId, $authUser->UserId);
         // add categories to the page (if set)
         if (isset($request['categories'])) {
             $categories = $request['categories'];
             $arr = explode(',', $categories);
             foreach ($arr as $categoryUniqId) {
                 $category = Category::GetByCategoryUniqId($categoryUniqId);
                 if ($category != NULL) {
                     Page::AddCategory($page['PageId'], $category['CategoryId']);
                 }
             }
         }
         // return a json response
         $response = new Tonic\Response(Tonic\Response::OK);
         $response->contentType = 'application/json';
         $response->body = json_encode($page);
         return $response;
     } else {
         // unauthorized access
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:55,代码来源:page.php

示例2: get

 /**
  * @method POST
  */
 function get()
 {
     // get an authuser
     $authUser = new AuthUser();
     if (isset($authUser->UserUniqId)) {
         // check if authorized
         $pageTypeId = -1;
         parse_str($this->request->data, $request);
         // parse request
         if (isset($request['pageTypeId'])) {
             $pageTypeId = $request['pageTypeId'];
         }
         if (isset($request['friendlyId'])) {
             $friendlyId = $request['friendlyId'];
             $pageType = PageType::GetByFriendlyId($friendlyId, $authUser->SiteId);
             // look up id
             $pageTypeId = $pageType['PageTypeId'];
         }
         if (isset($request['pageTypeUniqId'])) {
             $pageType = PageType::GetByPageTypeUniqId($request['pageTypeUniqId']);
             // look up id
             $pageTypeId = $pageType['PageTypeId'];
         }
         // check that pageTypeId was set
         if ($pageTypeId != -1) {
             $list = Category::GetCategories($pageTypeId);
             // return a json response
             $response = new Tonic\Response(Tonic\Response::OK);
             $response->contentType = 'application/json';
             $response->body = json_encode($list);
             return $response;
         } else {
             // return an empty response (e.g. root has not categories)
             $response = new Tonic\Response(Tonic\Response::OK);
             $response->contentType = 'application/json';
             $response->body = '[]';
             return $response;
         }
     } else {
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:45,代码来源:category.php

示例3: get

 /**
  * @method POST
  */
 function get()
 {
     parse_str($this->request->data, $request);
     // parse request
     $siteUniqId = SITE_UNIQ_ID;
     $pageTypeUniqId = $request['pageTypeUniqId'];
     $site = Site::GetBySiteUniqId($siteUniqId);
     $pageType = PageType::GetByPageTypeUniqId($pageTypeUniqId);
     // Get all pages
     $total = Page::GetPagesCount($site['SiteId'], $pageType['PageTypeId'], true);
     $json = '{"total":"' . $total . '"}';
     header('Content-type: application/json');
     // return a json response
     $response = new Tonic\Response(Tonic\Response::OK);
     $response->contentType = 'applicaton/json';
     $response->body = $json;
     return $response;
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:21,代码来源:page.php

示例4: delete

 /**
  * @method DELETE
  */
 function delete($pageTypeUniqId)
 {
     // get an authuser
     $authUser = new AuthUser();
     if (isset($authUser->UserUniqId)) {
         // check if authorized
         $pageType = PageType::GetByPageTypeUniqId($pageTypeUniqId);
         $site = Site::GetBySiteId($pageType['SiteId']);
         // remove pages for that pagetype in that site
         $dir = '../sites/' . $site['FriendlyId'] . '/' . $pageType['FriendlyId'];
         if (file_exists($dir)) {
             Utilities::RemoveDirectory($dir);
         }
         // remove page type and pages from DB
         PageType::Delete($pageType['PageTypeId']);
         return new Tonic\Response(Tonic\Response::OK);
     } else {
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:23,代码来源:pageType.php


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