本文整理汇总了PHP中SiteHelper类的典型用法代码示例。如果您正苦于以下问题:PHP SiteHelper类的具体用法?PHP SiteHelper怎么用?PHP SiteHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SiteHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: actionVote
/**
* Adds one vote to the subject votes count, a like or dislike.
* @param integer $vote_id the ID of the subject
* @param string $vote the vote: either like or dislike
*/
public function actionVote($subject_id, $vote = "")
{
global $arr_response;
if (!Yii::app()->user->isGuest) {
$subject_count = Subject::add_vote($subject_id, $vote, Yii::app()->user->id);
if ($subject_count['success'] == true) {
$arr_response['subject_vote'] = SiteHelper::subject_vote($subject_count['subject_id'], $subject_count['likes'], $subject_count['dislikes'], true);
$arr_response['response_message'] = Yii::t('subject', 'Vote sent.');
} else {
$arr_response['response_code'] = 409;
$arr_response['response_message'] = $subject_count['message'];
}
} else {
$arr_response['response_code'] = 401;
$arr_response['response_message'] = Yii::t('subject', 'Sorry, you must log in to be able to vote.');
}
}
开发者ID:jjsub,项目名称:samesub,代码行数:22,代码来源:SubjectController.php
示例17: run
public function run($args)
{
$list = array("catalog_users", "catalog_firms", "catalog_tours", "catalog_firms_service", "catalog_firms_items");
for ($i = 0; $i < sizeof($list); $i++) {
$catalog = SiteHelper::getCamelCase($list[$i]);
$listItems = $catalog::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("!EXISTS(SELECT id FROM notifications_queue WHERE catalog='" . $list[$i] . "' AND item_id=" . $list[$i] . "_as.id)")->setLimit(50)->setOrderBy("rating"));
//$listItems = $catalog::fetchAll( DBQueryParamsClass::CreateParams()->setConditions("id=13")->setLimit( 100 )->setOrderBy("rating") );
if (sizeof($listItems) > 0) {
foreach ($listItems as $item) {
$tableName = $item->tableName();
switch ($item->tableName()) {
case "catalog_users":
if ($item->active == 0) {
AutoNotifier::onRegistration($item);
} else {
$countFirms = CatalogFirms::count(DBQueryParamsClass::CreateParams()->setConditions("user_id=:uid")->setParams(array(":uid" => $item->id)));
if ($countFirms == 0) {
$tableName = "catalog_users_con";
AutoNotifier::onRegistrationConfirm($item);
} else {
continue 2;
}
}
break;
case "catalog_firms":
$item->onAddFirm(new CModelEvent($item), array("status" => "reminder"));
break;
case "catalog_tours":
$item->onAddTour(new CModelEvent($item), array("status" => "reminder"));
break;
case "catalog_firms_items":
$item->onAddFirmsItems(new CModelEvent($item), array("status" => "reminder"));
break;
case "catalog_firms_service":
$item->onAddFirmsService(new CModelEvent($item), array("status" => "reminder"));
break;
case "catalog_firms_banner":
$item->onAddFirmsBanners(new CModelEvent($item), array("status" => "reminder"));
break;
}
AutoNotifier::addInNotificationsQueue($tableName, $item->id, 0);
}
return "";
}
}
}
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:46,代码来源:AutoNotifierAddQueueCommand.php
示例18: actionSave
public function actionSave()
{
$addModel = new CatalogWorkAdd();
if (!empty($_POST["CatalogWorkAdd"]) && !Yii::app()->user->isGuest) {
$addModel->setAttributesFromArray($_POST["CatalogWorkAdd"]);
$addModel->user_id = Yii::app()->user->getId();
$addModel->status_id = 1;
$addModel->active = 1;
$addModel->date = time();
if ($addModel->save()) {
$id = $addModel->id;
$this->redirect(SiteHelper::createUrl("/adsUsers", array("saved" => $id)));
} else {
$p = (int) Yii::app()->request->getParam("p", 1);
$items = CatalogWork::fetchAll(DBQueryParamsClass::CreateParams()->setCache(0)->setLimit(25)->setPage($p)->setOrderBy("id DESC"));
$this->render("index", array("items" => $items, "addModel" => $addModel));
}
}
}
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:19,代码来源:WorkController.php
示例19: check_passwords
public function check_passwords($attribute, $params)
{
if (!$this->hasErrors()) {
$key = !empty($_GET["key"]) ? SiteHelper::checkedVaribal($_GET["key"], "string") : "";
$confirm = CatalogUsersConfirm::findByAttributes(array("confirm_key" => $key));
if (!empty($confirm) && sizeof($confirm) == 1) {
$userModel = CatalogUsers::fetch($confirm[0]->user_id->id);
if ($userModel->active == 0) {
$error = Yii::t("models", "Ваш аккаунт не активирован");
}
} else {
$error = Yii::t("models", "Указан не верный ключ");
}
if (!empty($error)) {
$this->addErrors(array("0" => $error));
} else {
$confirm[0]->delete();
}
}
}
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:20,代码来源:CatalogUsersLostConfirm.php
示例20: check_exists_params
public function check_exists_params($attribute, $params)
{
if (!$this->hasErrors()) {
$identity = new UserIdentity($this->email, $this->password);
$errorCode = $identity->authenticate();
if ($errorCode == 0) {
Yii::app()->user->login($identity);
} else {
if ($errorCode == 100) {
$textError = Yii::t("models", "Вы не подтвердили Свой Email") . ":" . $this->email . "<br/>";
$textError .= Yii::t("models", "Вам по почте должно было прийти письмо для подтверждения регистрации.") . "<br/><br/><b>" . Yii::t("models", "Письмо не пришло?") . "</b><br/><a href=\"" . SiteHelper::createUrl("/user/default/resend", array("email" => $this->email)) . "\">" . Yii::t("models", "отправить заново письмо для подтверждения регистрации на") . " " . $this->email . "</a>\n <br/><br/><b>" . Yii::t("models", "Все равно не пришло?</b><br/>Это странно, тогда Вам необходимо будет написать, с Email который вы указали при регистрации, письмо в службу тех. поддержки") . " <a href=\"mailto:" . Yii::app()->params["supportEmail"] . "\">" . Yii::app()->params["supportEmail"] . "</a><br/>" . Yii::t("models", "Пример письма:<br/>Заголовок письма - У меня проблемы с регистрацией<br/>Текст сообщения - Разберитесь пожалуйста");
$this->addErrors(array("0" => $textError));
} else {
$textError = "Вы ввели не верный Email или ПАРОЛЬ<br/>";
$textError .= "<br/><b>" . Yii::t("models", "Забыли пароль?") . "</b><br/><a href=\"" . SiteHelper::createUrl("/user/default/lost") . "\">" . Yii::t("models", "восстановить пароль") . "</a>";
$this->addErrors(array("0" => $textError));
}
}
}
}
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:20,代码来源:CatalogUsersAuth.php
注:本文中的SiteHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论