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


PHP SiteHelper::setLog方法代码示例

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


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

示例1: actionSave

 public function actionSave()
 {
     $addModel = new CatalogItemsAdd();
     if (!empty($_POST["CatalogItemsAdd"]) && !Yii::app()->user->isGuest) {
         $addModel->setAttributesFromArray($_POST["CatalogItemsAdd"]);
         $addModel->user_id = Yii::app()->user->getId();
         $addModel->status_id = 1;
         $addModel->active = 1;
         $addModel->date = time();
         if ($addModel->save()) {
             $id = $addModel->id;
             SiteHelper::setLog($addModel->tableName(), "add", $addModel->id, Yii::app()->user->getId());
             $this->redirect(SiteHelper::createUrl("/adsUsers", array("saved" => $id)));
         } else {
             $p = (int) Yii::app()->request->getParam("p", 1);
             $items = CatalogItems::fetchAll(DBQueryParamsClass::CreateParams()->setCache(0)->setLimit(25)->setPage($p)->setOrderBy("id DESC"));
             $this->render("index", array("items" => $items, "categoryModel" => new CatalogItemsCategory(), "addModel" => $addModel));
         }
     }
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:20,代码来源:AdsUsersController.php

示例2: actionDescription

 public function actionDescription($gallError = "")
 {
     $_POST["CatalogWorkResumeAdd"]["user_id"] = Yii::app()->user->getId();
     $_POST["CatalogWorkResumeAdd"]["type_id"] = 1;
     if (!Yii::app()->user->isGuest) {
         Yii::app()->page->title = Yii::t("page", "Описание");
         $id = (int) Yii::app()->request->getParam("id", 0);
         $status = Yii::app()->request->getParam("status", "");
         $error = Yii::app()->request->getParam("error", "");
         $addClass = $this->addModel;
         if (!empty($id)) {
             $item = $addClass::fetch($id);
         } else {
             $item = new $addClass();
             SiteHelper::setLog($item->tableName(), "open_add_form", $item->id, Yii::app()->user->getId());
         }
         if (!$item->id || $item->user_id->id == Yii::app()->user->getId()) {
             $message = !empty($status) && $status == 'saved' ? Yii::t("user", "Сохранено") : "";
             // Описание объявления
             if (!empty($_POST["update"])) {
                 if (!$item->id) {
                     $isAdd = true;
                 } else {
                     $isAdd = false;
                 }
                 $item->setAttributesFromArray($_POST[$addClass]);
                 //$item->is_resume = 0;
                 if (!$item->date) {
                     $item->date = time();
                 }
                 if (!$item->id) {
                     $item->user_id = Yii::app()->user->getId();
                 }
                 if ($item->save()) {
                     if ($isAdd) {
                         $action = "create";
                     } else {
                         $action = "edit";
                     }
                     SiteHelper::setLog($item->tableName(), $action, $item->id, Yii::app()->user->getId());
                     $this->redirect(SiteHelper::createUrl("/user/" . Yii::app()->controller->getId() . "/description/", array("id" => $item->id, "status" => "saved")));
                     die;
                     //if( !$isAdd )$message = "Описание успешно обновленно";
                     //        else $message = "Запись успешно добавлена";
                 }
                 //                    else $message = "Произошла ошибка обновления описания";
             }
             $action = Yii::app()->request->getParam("action");
             $gall_id = (int) Yii::app()->request->getParam("gall_id", 0);
             $comMessage = "";
             $gallMessage = "";
             if (!empty($gallError)) {
                 $message = $gallError;
             }
             // Удаление фотографии
             if (!empty($action) && $gall_id > 0) {
                 $comModel = CatGallery::fetch($gall_id);
                 if ($comModel->id > 0 && $comModel->item_id == $item->id) {
                     if ($action == "delGallery") {
                         $comModel->delete();
                         $gallMessage = Yii::t("user", "Картинка удалена");
                     }
                 }
             }
             $comm_id = (int) Yii::app()->request->getParam("comm_id", 0);
             if (!empty($action) && $comm_id > 0) {
                 $comModel = CatComments::fetch($comm_id);
                 if ($comModel->id > 0 && $comModel->item_id->id == $item->id) {
                     if ($action == "delComment") {
                         $comModel->delete();
                         $comMessage = Yii::t("user", "Комментарий удален");
                     }
                     if ($action == "validComment") {
                         $comModel->is_valid = 1;
                         $comModel->save();
                         $comMessage = Yii::t("user", "Комментарий успешно опубликован");
                     }
                 }
             }
             $addImage = new CatGalleryAdd();
             if ($error == "gallError") {
                 $addImage->addError("error upload", Yii::t("user", "Произошла ошибка добавления фото, попробуте заново или обратитеcь к тех. потдержке") . " ( Email : " . Yii::app()->params["supportEmail"] . " ) ");
             }
             if (!empty($_POST["sendGallery"])) {
                 if ($id > 0) {
                     $this->uploadImages((int) $id, get_class($item));
                 }
             }
             // Сохранение подписи для фотографий
             if (!empty($_POST["saveTitle"])) {
                 $this->gallerySaveTitle();
             }
             $listComments = CatComments::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("catalog=:catalog AND item_id=:item_id")->setParams(array(":catalog" => $item->tableName(), ":item_id" => $item->id))->setLimit(50)->setCache(0));
             $listGallery = CatGallery::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("catalog=:catalog AND item_id=:item_id")->setParams(array(":catalog" => $item->tableName(), ":item_id" => $item->id))->setLimit(50)->setCache(0));
             $this->render("description", array("item" => $item, "firm" => null, "listGallery" => $listGallery, "message" => $message, "addImage" => $addImage, "comMessage" => $comMessage, "gallMessage" => $gallMessage, "listComments" => $listComments));
         }
     }
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:98,代码来源:ResumeController.php

示例3: actionSetPublish

 public function actionSetPublish()
 {
     $id = (int) Yii::app()->request->getParam("id", 0);
     $catalog = Yii::app()->request->getParam("catalog");
     if ($id > 0 && !empty($catalog)) {
         $newCatalog = new $catalog();
         $modelClass = SiteHelper::getCamelCase($newCatalog->tableName());
         $model = $modelClass::fetch($id);
         $listImages = CatGallery::findByAttributes(array("catalog" => $newCatalog->tableName(), "item_id" => $id));
         $imagesMin = SiteHelper::getConfig("publish_min_images");
         $sizeofImages = sizeof($listImages);
         if ($model->image) {
             $sizeofImages++;
         }
         // Для CatalogFirmsBannersAdd не должно влиять ограичение перед публиацией по количесву картинок
         if ($sizeofImages >= $imagesMin || $catalog == "CatalogFirmsBannersAdd" || $catalog == "CatalogFirmsBanners") {
             $error = false;
             $commentModel = $catalog::fetch($id);
             if (($catalog == "CatalogFirmsBannersAdd" || $catalog == "CatalogFirmsBanners") && !$commentModel->file) {
                 $error = true;
             }
             if ($commentModel->user_id->id != Yii::app()->user->getId() && $commentModel->firm_id->user_id->id != Yii::app()->user->getId()) {
                 $error = true;
             }
             if (!$error) {
                 if ($commentModel->user_id && $commentModel->user_id->id > 0) {
                     $id = $commentModel->user_id->id;
                 } else {
                     $id = $commentModel->firm_id->user_id->id;
                 }
                 if ($commentModel->id > 0 && $id == Yii::app()->user->getId()) {
                     if ($commentModel->active == 0) {
                         $commentModel->active = 1;
                         $action = "publish";
                     } else {
                         $commentModel->active = 0;
                         $action = "nopublish";
                     }
                     SiteHelper::setLog($newCatalog->tableName(), $action, $commentModel->user_id->id, Yii::app()->user->getId());
                     if ($commentModel->save()) {
                         echo 1;
                     } else {
                         print_r($commentModel->getErrors());
                     }
                     return;
                 }
             }
         } else {
             echo 3;
             return;
         }
     }
     echo 0;
     return;
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:55,代码来源:FirmsController.php

示例4: actionDescription

 public function actionDescription($gallError = "")
 {
     if (!Yii::app()->user->isGuest) {
         Yii::app()->page->title = Yii::t("page", "Описание");
         $id = (int) Yii::app()->request->getParam("id", 0);
         $status = Yii::app()->request->getParam("status", "");
         $error = Yii::app()->request->getParam("error", "");
         $addClass = $this->addModel;
         if (!empty($id)) {
             $item = $addClass::fetch($id);
         } else {
             $item = new $addClass();
             SiteHelper::setLog($item->tableName(), "open_add_form", $item->id, Yii::app()->user->getId());
         }
         if (!$item->id || ($item->user_id && $item->user_id->id == Yii::app()->user->getId() || $item->firm_id && $item->firm_id->user_id->id == Yii::app()->user->getId())) {
             if (property_exists($item, "firm_id") && $item->firm_id) {
                 $firm = $item->firm_id;
             }
             if (!property_exists($item, "firm_id") && $item->id) {
                 $firm = $item;
             }
             if (empty($firm) || $firm->id == 0) {
                 $fid = (int) Yii::app()->request->getParam("fid", 0);
                 $firm = CatalogFirms::fetch($fid);
             }
             $message = !empty($status) && $status == 'saved' ? Yii::t("user", "Сохранено") : "";
             // Описание объявления
             if (!empty($_POST["update"])) {
                 if (!$item->id) {
                     $isAdd = true;
                 } else {
                     $isAdd = false;
                 }
                 $item->setAttributesFromArray($_POST[$addClass]);
                 //$item->is_resume = 0;
                 if (!$item->date) {
                     $item->date = time();
                 }
                 if (property_exists($item, "edit_date")) {
                     $item->edit_date = time();
                 }
                 $item->user_id = Yii::app()->user->getId();
                 if ($item->save()) {
                     if ($isAdd) {
                         $action = "create";
                     } else {
                         $action = "edit";
                     }
                     SiteHelper::setLog($item->tableName(), $action, $item->id, Yii::app()->user->getId());
                     switch (Yii::app()->controller->getId()) {
                         case "firms":
                             LogHelper::saveCatLogEdit(1, 0);
                             break;
                         case "tours":
                             LogHelper::saveCatLogEdit(0, 1);
                             break;
                     }
                     $arrayParam = array("id" => $item->id, "status" => "saved");
                     if ($firm->id > 0) {
                         $arrayParam["fid"] = $firm->id;
                     }
                     switch ($item->tableName()) {
                         case "catalog_firms":
                             $item->onAddFirm(new CModelEvent($item), array());
                             break;
                         case "catalog_tours":
                             $item->onAddTour(new CModelEvent($item), array());
                             break;
                         case "catalog_firms_items":
                             $item->onAddFirmsItems(new CModelEvent($item), array());
                             break;
                         case "catalog_firms_service":
                             $item->onAddFirmsService(new CModelEvent($item), array());
                             break;
                         case "catalog_firms_banner":
                             $item->onAddFirmsBanners(new CModelEvent($item), array());
                             break;
                     }
                     // Добавляем в очередь на нотификацию
                     // В течении 24 часов после добавления или сохранения пользователю приходят уведомления
                     // О том что заполнил не полностью, не опубликовал, не добавил картинок и т.д.
                     AutoNotifier::addInNotificationsQueue($item->tableName(), $item->id);
                     $this->redirect(SiteHelper::createUrl("/user/" . Yii::app()->controller->getId() . "/description/", $arrayParam));
                     die;
                 }
             }
             $action = Yii::app()->request->getParam("action");
             $gall_id = (int) Yii::app()->request->getParam("gall_id", 0);
             $comMessage = "";
             $gallMessage = "";
             if (!empty($gallError)) {
                 $message = $gallError;
             }
             // Удаление фотографии
             if (!empty($action) && $gall_id > 0) {
                 $comModel = CatGallery::fetch($gall_id);
                 if ($comModel->id > 0 && $comModel->item_id == $item->id) {
                     if ($action == "delGallery") {
                         $comModel->delete();
                         $gallMessage = Yii::t("user", "Картинка удалена");
//.........这里部分代码省略.........
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:101,代码来源:UserController.php

示例5: actionDescription

 public function actionDescription($gallError = "")
 {
     $_POST["CatalogFirmsBannersAdd"]["firm_id"] = $this->firmId;
     $_POST["CatalogFirmsBannersAdd"]["user_id"] = Yii::app()->user->getId();
     if (!Yii::app()->user->isGuest) {
         Yii::app()->page->title = Yii::t("page", "Описание");
         $id = (int) Yii::app()->request->getParam("id", 0);
         $status = Yii::app()->request->getParam("status", "");
         $error = Yii::app()->request->getParam("error", "");
         $addClass = $this->addModel;
         if (!empty($id)) {
             $item = $addClass::fetch($id);
         } else {
             $item = new $addClass();
             SiteHelper::setLog($item->tableName(), "open_add_form", $item->id, Yii::app()->user->getId());
         }
         $count = CatalogBannerRequest::count();
         $maxCount = SiteHelper::getConfig("banner_max_count");
         $checkedRequest = CatalogBannerRequest::findByAttributes(array("banner_id" => $item->id));
         if (!$item->id || ($item->user_id && $item->user_id->id == Yii::app()->user->getId() || $item->firm_id && $item->firm_id->user_id->id == Yii::app()->user->getId())) {
             if (property_exists($item, "firm_id") && $item->firm_id) {
                 $firm = $item->firm_id;
             }
             if (!property_exists($item, "firm_id") && $item->id) {
                 $firm = $item;
             }
             if (empty($firm) || $firm->id == 0) {
                 $fid = (int) Yii::app()->request->getParam("fid", 0);
                 $firm = CatalogFirms::fetch($fid);
             }
             $message = !empty($status) && $status == 'saved' ? Yii::t("user", "Сохранено") : "";
             // Описание объявления
             if (!empty($_POST["update"])) {
                 if (!$item->id) {
                     $isAdd = true;
                 } else {
                     $isAdd = false;
                 }
                 $item->setAttributesFromArray($_POST[$addClass]);
                 //$item->is_resume = 0;
                 if (!$item->date) {
                     $item->date = time();
                 }
                 $item->user_id = Yii::app()->user->getId();
                 if ($item->save()) {
                     if ($isAdd) {
                         $action = "create";
                     } else {
                         $action = "edit";
                     }
                     SiteHelper::setLog($item->tableName(), $action, $item->id, Yii::app()->user->getId());
                     if (!empty($_POST["banner_request"])) {
                         if ($count < $maxCount) {
                             if (sizeof($checkedRequest) == 0) {
                                 $newRequest = new CatalogBannerRequest();
                                 $newRequest->banner_id = $item->id;
                                 $newRequest->date = time();
                                 $newRequest->active = 0;
                                 $newRequest->save();
                                 $newRequest->onBannerRequest(new CModelEvent($newRequest), array("id" => $newRequest->id, "date" => date("d.m.Y")));
                             }
                         }
                     }
                     $this->redirect(SiteHelper::createUrl("/user/" . Yii::app()->controller->getId() . "/description/", array("id" => $item->id, "fid" => $firm->id, "status" => "saved")));
                     die;
                 }
             }
             $this->render("description", array("checkedRequest" => sizeof($checkedRequest), "count" => $count, "maxCount" => $maxCount, "item" => $item, "firm" => $firm, "listGallery" => array(), "message" => $message, "addImage" => null, "comMessage" => "", "gallMessage" => "", "listComments" => array()));
         }
     }
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:71,代码来源:FirmBannersController.php

示例6: lostPasswordConfirm

 static function lostPasswordConfirm($event)
 {
     $userSender = $event->sender[0];
     $user = CatalogUsers::fetch($userSender->user_id->id);
     $user->password = md5($_POST["CatalogUsersLostConfirm"]["password"]);
     $user->save();
     SiteHelper::setLog("catalog_users", "lost_password", $user->id);
     if ($user->hasErrors() && sizeof($user) > 0) {
         $errors = "Ошибка сохранение нового пароля: ";
         foreach ($user->getErrors() as $data) {
             foreach ($data as $key => $value) {
                 $errors .= $value . ", ";
             }
         }
         throw new Exception($errors);
     } else {
         // Отправляем письмо уведомления о смене пароля
         Yii::app()->notifications->send("lostpassword_save", ["mail"], $user->id);
     }
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:20,代码来源:UserNotifier.php


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