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


PHP SiteHelper类代码示例

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


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

示例1: actionIndex

 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     Yii::app()->page->title = "Описание продукции";
     $id = (int) Yii::app()->request->getParam("id", 0);
     if ($id > 0) {
         $item = CatalogItems::fetchParam($id);
         $otherItem = CatalogItems::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("id!=:id AND category_id=:cid")->setParams(array(":id" => $item->id, ":cid" => $item->category_id->id))->setOrderBy("price")->setLimit(10));
         $hotItem = CatalogItems::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("id!=:id AND is_hot=:hot")->setParams(array(":id" => $item->id, ":hot" => 1))->setOrderBy("price")->setLimit(10));
         if ($item->id > 0) {
             $favorites = Yii::app()->request->getParam("favorites", "");
             if ($favorites == "add") {
                 $res = Yii::app()->favorites->add("catalog_items", $item->id);
             }
             $newComment = new CatalogItemsCommentsAdd();
             // Сохраняем комментарий
             if (!empty($_POST["sentComment"])) {
                 $newComment->setAttributesFromArray($_POST["CatalogItemsCommentsAdd"]);
                 $newComment->date = time();
                 $newComment->user_id = Yii::app()->user->id;
                 $newComment->item_id = $id;
                 if ($newComment->save()) {
                     $newComment->formMessage = "Комментарий успешно отправлен.";
                     $newComment->onNewComment(new CModelEvent($newComment), array("id" => $item->id, "name" => $item->name, "subject" => $newComment->subject, "link" => SiteHelper::createUrl("/user/items/index", array("id" => $newComment->item_id))));
                 }
             }
             $listComments = CatalogItemsComments::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("item_id=:item_id AND is_valid=1")->setParams(array(":item_id" => $item->id))->setOrderBy("date DESC"));
             $this->render("item", array("item" => $item, "otherItem" => $otherItem, "hotItem" => $hotItem, "addForm" => $newComment, "listComments" => $listComments));
         } else {
             $this->redirect("/");
         }
     } else {
         $this->redirect("/");
     }
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:38,代码来源:ItemController.php

示例2: actionIndex

 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     $limit = 30;
     $p = (int) Yii::app()->request->getParam("p", 1);
     $catalog = Yii::app()->request->getParam("catalog", "");
     Yii::app()->page->title = "Выставить слаг";
     if (!empty($catalog)) {
         $catalogS = SiteHelper::getCamelCase($catalog);
         $items = $catalogS::fetchAll(DBQueryParamsClass::CreateParams()->setLimit($limit)->setCache(0)->setPage($p));
         //echo sizeof( $items )."*";
         //die;
         foreach ($items as $item) {
             //echo "#".$item->id."<br/>";
             $item->description = str_replace("< ", "<", $item->description);
             if (!$item->save()) {
                 print_r($item->getErrors());
                 //die;
             }
         }
         if (sizeof($items) == $limit) {
             $this->redirect(SiteHelper::createUrl("/console/CheckDescriptionTag", array("catalog" => $catalog, "p" => $p + 1)));
         }
     } else {
         $items = array();
     }
     $this->render("index", array("items" => $items));
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:31,代码来源:CheckDescriptionTagController.php

示例3: actionRecharge

 public function actionRecharge()
 {
     if (!Yii::app()->user->isGuest) {
         $error = "";
         if (!empty($_POST["recharge_submit"])) {
             $newPlantRequest = new OrderRequest();
             $price = (int) $_POST["price"];
             if ($price > 0) {
                 $newPlantRequest->user_id = Yii::app()->user->id;
                 $newPlantRequest->type_id = 2;
                 $newPlantRequest->status_id = 2;
                 $newPlantRequest->date = time();
                 $newPlantRequest->amount = $price;
                 if ($newPlantRequest->save()) {
                     $this->redirect(SiteHelper::createUrl("/merchant/index", array("id" => $newPlantRequest->id)));
                 }
             } else {
                 $error = "Вы ввели не верную сумму";
             }
         }
         Yii::app()->page->title = "Пополнения счета";
         $this->render("recharge", array("error" => $error));
     } else {
         $this->redirect(SiteHelper::createUrl("/"));
     }
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:26,代码来源:FprofileController.php

示例4: actionIndex

 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     $limit = 30;
     $p = (int) Yii::app()->request->getParam("p", 1);
     $catalog = Yii::app()->request->getParam("catalog", "");
     Yii::app()->page->title = "Выставить слаг";
     if (!empty($catalog)) {
         $catalogS = SiteHelper::getCamelCase($catalog);
         $items = $catalogS::fetchAll(DBQueryParamsClass::CreateParams()->setLimit($limit)->setCache(0)->setPage($p));
         //echo sizeof( $items )."*";
         //die;
         for ($i = 0; $i < sizeof($items); $i++) {
             if (strpos($items[$i]->description, "</xml>") !== false) {
                 $arr = explode("</xml>", $items[$i]->description);
                 $items[$i]->description = $arr[1];
                 if (empty($items[$i]->description)) {
                     $items[$i]->description = "  - ";
                 }
                 if (!$items[$i]->save()) {
                     //print_r( $items[$i]->getErrors() );
                     //die;
                 }
             }
         }
         if (sizeof($items) == $limit) {
             $this->redirect(SiteHelper::createUrl("/console/CheckDescription", array("catalog" => $catalog, "p" => $p + 1)));
         }
     } else {
         $items = array();
     }
     $this->render("index", array("items" => $items));
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:36,代码来源:CheckDescriptionController.php

示例5: actionIndex

 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     Yii::app()->page->title = "Каталог продукции";
     if (!Yii::app()->user->isGuest) {
         $itemModel = new CatalogItemsAdd();
         if (!empty($_POST["save_profile"])) {
             $itemModel->setAttributesFromArray($_POST["CatalogItemsAdd"]);
             $itemModel->user_id = Yii::app()->user->id;
             $itemModel->status_id = 3;
             // По умолчанию не активен
             $itemModel->date = time();
             if ($itemModel->saveParam()) {
                 $itemModel->onAddItem(new CModelEvent($itemModel), array("id" => $itemModel->id, "subject" => $itemModel->name, "date" => date("d.m.Y"), "description" => SiteHelper::getSubTextOnWorld($itemModel->description, 200), "link" => Yii::app()->params["adminEmail"] . SiteHelper::createUrl("/user/items/description/", array("id" => $itemModel->id))));
                 $this->redirect(SiteHelper::createUrl("/catalog/add/save", array("id" => $itemModel->id)));
             }
         }
         $addDopParams = null;
         if ($itemModel->category_id && $itemModel->category_id->id > 0) {
             $categoryModel = CatalogItemsCategory::fetch($itemModel->category_id->id);
             if ($categoryModel->table_name) {
                 $catalogClass = SiteHelper::getCamelCase($categoryModel->table_name);
                 $addDopParams = new $catalogClass();
             }
         }
         $this->render("add", array("form" => $itemModel, "addDopParams" => $addDopParams));
     } else {
         Yii::app()->session['redirect'] = SiteHelper::createUrl("/catalog/add");
         $this->render("addauthWidget");
     }
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:34,代码来源:AddController.php

示例6: actionDescription

 public function actionDescription($gallError = "")
 {
     $this->firmId = (int) Yii::app()->request->getParam("fid", 0);
     $id = (int) Yii::app()->request->getParam("id", 0);
     // Если не указан ID фирмы, то берем ID из описания тура
     if ($id > 0 && $this->firmId == 0) {
         $tourModel = CatalogTours::fetch($id);
         if ($tourModel->id > 0 && $tourModel->firm_id && $tourModel->firm_id->id > 0) {
             $this->firmId = $tourModel->firm_id->id;
         }
     }
     if ($this->firmId == 0) {
         die("id==0");
         $this->redirect(SiteHelper::createUrl("/user/firms"));
     }
     $firmModel = CatalogFirms::fetch($this->firmId);
     if ($firmModel->id == 0) {
         die("id==not correct");
         $this->redirect(SiteHelper::createUrl("/user/firms"));
     }
     parent::init();
     $this->addModel = "CatalogToursAdd";
     $this->tableName = "catalog_tours";
     $this->name = Yii::t("user", "туры");
     $_POST["CatalogToursAdd"]["firm_id"] = $this->firmId;
     $_POST["CatalogToursAdd"]["user_id"] = Yii::app()->user->getId();
     parent::actionDescription();
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:28,代码来源:ToursController.php

示例7: run

 public function run()
 {
     if ($this->beginCache("socialLink_block_" . Yii::app()->getLanguage(), array('duration' => 3600))) {
         if (!$this->url) {
             $this->url = SiteHelper::createUrl("") . $_SERVER["REQUEST_URI"];
         }
         $this->render("socialLink", array("id" => $this->id, "url" => $this->url));
         $this->endCache();
     }
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:10,代码来源:socialLinksWidget.php

示例8: actionDelete

 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete()
 {
     if ($this->id > 0) {
         $item = ExBanner::fetch($this->id);
         if ($item->id > 0) {
             $item->delete();
             $this->redirect(SiteHelper::createUrl("/console/banners"));
         }
     }
     $this->redirect(SiteHelper::createUrl("/console/banners"));
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:16,代码来源:BannersController.php

示例9: actionDelete

 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete()
 {
     if ($this->id > 0) {
         $item = CatComments::fetch($this->id);
         if ($item->id > 0) {
             $item->delete();
             $this->redirect(SiteHelper::createUrl("/console/comments"));
         }
     }
     $this->redirect(SiteHelper::createUrl("/console/comments"));
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:16,代码来源:CommentsController.php

示例10: actionDescription

 public function actionDescription()
 {
     $slug = Yii::app()->request->getParam("slug", "");
     if (!empty($slug)) {
         $item = CatalogMaps::fetchBySlug("map-" . $slug);
         Yii::app()->page->setTitle($item->name);
         $list = CatalogWheters::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("city_id=:id")->setParams(array(":id" => $item->city_id->id))->setLimit(-1));
         $this->render("description", array("item" => $item, "list" => $list));
     } else {
         $this->redirect(SiteHelper::createUrl("/uzbekistanMaps"));
     }
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:12,代码来源:UzbekistanMapsController.php

示例11: actionIndex

 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     if (!Yii::app()->user->isGuest) {
         Yii::app()->page->title = "Оплата";
         /*
                     if( $_POST["register_submit_button"] )
                     {
                         $gateway = Yii::app()->getComponent('payment')->getGateway('PaypalExpress');
                         $response = $gateway->setupPurchase(100, array(
                             'return_url' => $this->createAbsoluteUrl(
                                 '/payment/callback', array('success' => 1, 'order_id' => 1)
                             ),
                             'cancel_return_url' => $this->createAbsoluteUrl(
                                 '/payment/callback', array('failed'  => 1, 'order_id'  => 1)
                             ),
                             'items' => array(
                                 array(
                                     'description' => 'Bla bla',
                                     'unit_price'  => 100,
                                     'quantity'    => 1,
                                     'id'              => 1
                                 )
                             )
                         ));
                         if ($response->success()) {
                             $this->redirect($gateway->urlForToken($response->token()));
                         }
         
                 // payment controller::callback action
                 // IPN
                         if (isset($_REQUEST['success'], $_GET['token'], $_GET['PayerID'])) {
                             $gateway = Yii::app()->getComponent('payment')->getGateway('PaypalExpress');
                             $response = $gateway->get_details_for($_GET['token'], $_GET['PayerID']);
                             $response = $gateway->purchase($response->amount());
                             if ($response->success()) {
                                 // success payment
                             } else {
                                 //error payment
                             }
                         }
                     }*/
         $id = Yii::app()->request->getParam("id", 0);
         if ($id > 0) {
             $order = OrderRequest::fetch($id);
             if ($order->id > 0 && $order->del == 0) {
                 $this->render('index', array("controller" => $this, "model" => $order));
             }
         } else {
             $this->redirect(SiteHelper::createUrl("/user/requsets"));
         }
     }
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:56,代码来源:MerchantController.php

示例12: run

 public function run()
 {
     if ($this->beginCache('widgetInfo_' . $this->class . $this->category_id . "_" . Yii::app()->getLanguage(), array('duration' => 3600))) {
         $className = $this->class;
         if ($this->category_id > 0) {
             $dopCondition = " AND category_id='" . (int) $this->category_id . "'";
         } else {
             $dopCondition = "";
         }
         $this->render("infoWidget", array('title' => $this->title, 'link' => SiteHelper::createUrl($this->link . "/description"), 'linkAll' => SiteHelper::createUrl($this->link), 'list' => $className::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("image>''" . $dopCondition)->setOrderBy("id DESC")->setLimit(9))));
         $this->endCache();
     }
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:13,代码来源:infoWidget.php

示例13: actionDelete

 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete()
 {
     if ($this->id > 0) {
         $item = I18n::fetch($this->id);
         if ($item->id > 0) {
             $item->delete();
             $itemTranslate = I18nTranslate::fetch($this->id);
             $itemTranslate->delete();
             $this->redirect(SiteHelper::createUrl("/console/variable"));
         }
     }
     $this->redirect(SiteHelper::createUrl("/console/variable"));
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:18,代码来源:VariableController.php

示例14: refreshParam

 public function refreshParam()
 {
     if ($this->category_id > 0) {
         $categoryModel = CatalogItemsCategory::fetch($this->category_id);
         if ($categoryModel->table_name) {
             $categoryTable = SiteHelper::getCamelCase($categoryModel->table_name);
             $paramItem = $categoryTable::findByAttributes(array("item_id" => $this->id));
             if (sizeof($paramItem) > 0) {
                 $this->param = $paramItem[0];
             } else {
                 $this->param = new $categoryTable();
             }
         }
     }
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:15,代码来源:CatalogCCModel.php

示例15: actionIndex

 public function actionIndex($slugInput = "")
 {
     $error = false;
     $slug = !empty($_GET["slug"]) ? $slug = SiteHelper::checkedVaribal($_GET["slug"]) : "";
     if (empty($slug) && !empty($slugInput)) {
         $slug = $slugInput;
     }
     if (!empty($slug)) {
         $page = CatalogContent::fetchBySlug($slug);
     }
     if (!empty($page) && $page->id > 0) {
         $this->render('index', array("page" => $page));
     } else {
         $this->redirect("/site/error");
     }
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:16,代码来源:PageController.php


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