本文整理汇总了PHP中SiteHelper::createUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteHelper::createUrl方法的具体用法?PHP SiteHelper::createUrl怎么用?PHP SiteHelper::createUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SiteHelper
的用法示例。
在下文中一共展示了SiteHelper::createUrl方法的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 = "Каталог продукции";
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");
}
}
示例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;
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));
}
示例3: 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("/");
}
}
示例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;
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));
}
示例5: 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();
}
示例6: 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("/"));
}
}
示例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();
}
}
示例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 = CatComments::fetch($this->id);
if ($item->id > 0) {
$item->delete();
$this->redirect(SiteHelper::createUrl("/console/comments"));
}
}
$this->redirect(SiteHelper::createUrl("/console/comments"));
}
示例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 = ExBanner::fetch($this->id);
if ($item->id > 0) {
$item->delete();
$this->redirect(SiteHelper::createUrl("/console/banners"));
}
}
$this->redirect(SiteHelper::createUrl("/console/banners"));
}
示例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"));
}
}
示例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"));
}
}
}
示例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();
}
}
示例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"));
}
示例14: 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));
}
}
}
示例15: 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));
}
}
}
}