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


PHP SiteHelper::getConfig方法代码示例

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


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

示例1: IN

<div id="firmTours">
    <?php 
if ($this->beginCache("firmDescriptionTours-" . $item->id . "_" . Yii::app()->getLanguage(), array('duration' => SiteHelper::getConfig("firmDescriptionTours")))) {
    ?>
        <div class="row">
            <?php 
    // Категории
    $listCategory = CatalogToursCategory::sql("SELECT id, owner FROM `catalog_tours_category` WHERE owner>0 AND id IN( SELECT category_id FROM catalog_tours WHERE firm_id=" . $item->id . " AND del=0  AND active=1 )");
    $reCategory = array();
    $reCategory2 = array();
    // Раскладываем по OWNER-у
    foreach ($listCategory as $category) {
        $reCategory[$category["owner"]][] = $category["id"];
    }
    // Подменяем ID на обект и подсчитываем количество
    foreach ($reCategory as $category => $value) {
        $ownerCategoryModel = CatalogToursCategory::fetch($category);
        $array = array();
        foreach ($value as $cid) {
            if ($cid > 0) {
                $obj = CatalogToursCategory::fetch($cid);
                $array[] = $obj;
            }
        }
        $reCategory2[$ownerCategoryModel->name] = $array;
    }
    // Странны
    $listCountry = CatalogCountry::sql("SELECT id FROM `catalog_country` WHERE id IN( SELECT country_id FROM catalog_tours WHERE firm_id=" . $item->id . " AND del=0 AND active=1 )");
    $reCountry2 = array();
    // Подменяем ID на обект и подсчитываем количество
    foreach ($listCountry as $id => $keys) {
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:31,代码来源:tours_page.php

示例2: run

 public function run($args)
 {
     $countLimit = SiteHelper::getConfig("subscribee_count_send");
     $emails = array();
     $countSend = 0;
     $res = SubscribeItems::findByAttributes(array("status_id" => 2));
     foreach ($res as $line) {
         // 1 - отправляем и зарегеным и подписчикам
         if ($line->users == 1 || $line->users == 2) {
             $lisUsers = CatalogUsers::sql("SELECT u.* FROM catalog_users u WHERE `active`=1 AND subscribe=1 AND !exists( SELECT id FROM subscribe_send WHERE email=u.email AND item_id='" . $line->id . "' AND is_reg=1 ) LIMIT " . $countLimit);
             foreach ($lisUsers as $userLine) {
                 $emails[] = array("email" => $userLine["email"], "name" => $userLine["name"]);
                 $newSend = new SubscribeSend();
                 $newSend->item_id = $line->id;
                 $newSend->user_id = $userLine["id"];
                 $newSend->email = $userLine["email"];
                 $newSend->is_reg = 1;
                 if (!$newSend->save()) {
                     print_r($newSend->getErrors());
                 }
             }
         }
         if (sizeof($emails) < $countLimit && ($line->users == 1 || $line->users == 3)) {
             $lisUsers = CatalogUsers::sql("SELECT u.* FROM subscribe_users u WHERE !exists( SELECT id FROM subscribe_send WHERE email=u.email AND item_id='" . $line->id . "' AND is_reg=0 ) LIMIT " . ($countLimit - sizeof($emails)));
             foreach ($lisUsers as $userLine) {
                 $emails[] = array("email" => $userLine["email"], "name" => $userLine["name"]);
                 $newSend = new SubscribeSend();
                 $newSend->item_id = $line->id;
                 $newSend->user_id = null;
                 $newSend->email = $userLine["email"];
                 $newSend->is_reg = 0;
                 if (!$newSend->save()) {
                     print_r($newSend->getErrors());
                 }
             }
         }
         if ($line->users == 4) {
             $usersList = trim(strip_tags($line->users_list));
             if (!empty($usersList)) {
                 $listEmail = explode(",", $usersList);
                 for ($m = 0; $m < sizeof($listEmail); $m++) {
                     $listEmail[$m] = trim($listEmail[$m]);
                     $ext = SubscribeSend::findByAttributes(array("item_id" => $line->id, "email" => $listEmail[$m]));
                     if (sizeof($ext) == 0) {
                         $emails[] = array("email" => $listEmail[$m], "name" => "пользователь");
                         $newSend = new SubscribeSend();
                         $newSend->item_id = $line->id;
                         $newSend->user_id = null;
                         $newSend->email = $listEmail[$m];
                         $newSend->is_reg = 0;
                         if (!$newSend->save()) {
                             print_r($newSend->getErrors());
                         }
                     }
                 }
             }
         }
         if (sizeof($emails) > 0) {
             for ($n = 0; $n < sizeof($emails); $n++) {
                 $countSend++;
                 $message = $line->description;
                 $message = str_replace("@user_name@", $emails[$n]["name"], $message);
                 SiteHelper::mailto($line->subject, $line->from, $emails[$n]["email"], stripslashes($message), "", "", array("<!-- @openSubscribeLink@ -->" => "<img src=\"" . Yii::app()->params["baseUrl"] . "site/subscribeOpen/subscribe/" . $line->id . "/email/" . $emails[$n]["email"] . "\" alt=\"\" style=\"width:0px;height:0px\" />"));
             }
         }
         // Сохраняем количество оптравленных, чтобы не считать каждый раз
         if ($countSend > 0) {
             $line->count_send += $countSend;
             $line->save();
         }
         // Если адресатов нет или их количество меньше чем лимит то финализируем рассылку
         if (sizeof($emails) == 0 || $countSend < $countLimit) {
             $line->status_id = 3;
             $line->save();
         }
     }
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:77,代码来源:SubscribeCommand.php

示例3: optimization


//.........这里部分代码省略.........
                 }
             }
             // Если указынны оба параметра то высоту обнуляем меньший из параметров
             if ($width > 0 && $height > 0) {
                 if ($width >= $height) {
                     $height = 0;
                 }
                 if ($width < $height) {
                     $width = 0;
                 }
             }
             // Если не указан один из параметров, то недостоющий расщитываем
             if (!$width && $height) {
                 $width = ceil($height * $hprocent / 100);
             }
             if ($width && !$height) {
                 $height = ceil($width * $wprocent / 100);
             }
             // Проверяем чтобы указынне параметры небыли больше чем заданы для данного типа картинки
             if ($width > $width0) {
                 $width = $width0;
             }
             if ($height > $height0) {
                 $height = $height0;
             }
             if ($width && $height) {
                 switch ($upload_type) {
                     case "jpg":
                         $image_o = imagecreatefromjpeg($dopUrl . $fileUrl);
                         break;
                     case "image/jpg":
                         $image_o = imagecreatefromjpeg($dopUrl . $fileUrl);
                         break;
                     case "jpeg":
                         $image_o = imagecreatefromjpeg($dopUrl . $fileUrl);
                         break;
                     case "image/jpeg":
                         $image_o = imagecreatefromjpeg($dopUrl . $fileUrl);
                         break;
                     case "image/pjpeg":
                         $image_o = imagecreatefromjpeg($dopUrl . $fileUrl);
                         break;
                     case "gif":
                         $image_o = imagecreatefromgif($dopUrl . $fileUrl);
                         break;
                     case "image/gif":
                         $image_o = imagecreatefromgif($dopUrl . $fileUrl);
                         break;
                     case "png":
                         $image_o = imagecreatefrompng($dopUrl . $fileUrl);
                         break;
                     case "image/png":
                         $image_o = imagecreatefrompng($dopUrl . $fileUrl);
                         break;
                 }
                 list($width_o, $height_o) = getimagesize($dopUrl . $fileUrl);
                 $new_file = imagecreatetruecolor($width, $height);
                 $res = imagecopyresampled($new_file, $image_o, 0, 0, 0, 0, $width, $height, $width_o, $height_o);
                 if ($res === True) {
                     switch ($upload_type) {
                         case "jpeg":
                             ImageJPEG($new_file, $new_file_name, Yii::app()->params["images_quality"]);
                             break;
                         case "image/jpeg":
                             ImageJPEG($new_file, $new_file_name, Yii::app()->params["images_quality"]);
                             break;
                         case "image/pjpeg":
                             ImageJPEG($new_file, $new_file_name, Yii::app()->params["images_quality"]);
                             break;
                         case "jpg":
                             ImageJPEG($new_file, $new_file_name, Yii::app()->params["images_quality"]);
                             break;
                         case "image/jpg":
                             ImageJPEG($new_file, $new_file_name, Yii::app()->params["images_quality"]);
                             break;
                         case "gif":
                             ImageGIF($new_file, $new_file_name);
                             break;
                         case "image/gif":
                             ImageGIF($new_file, $new_file_name);
                             break;
                         case "png":
                             ImagePNG($new_file, $new_file_name);
                             break;
                         case "image/png":
                             ImagePNG($new_file, $new_file_name);
                             break;
                     }
                 } else {
                     $cout = "<p class=\"err\">Произошла ошибка обработки файла (" . $new_file_name . ")</p>";
                 }
                 #Наложение логотипа на картинки
                 if (SiteHelper::getConfig("watermark")) {
                     $this->addLogoOnImage($dopUrl . $fileUrl, $upload_type, $dopUrl . SiteHelper::getConfig("watermark"), $catalog);
                 }
             }
         }
     }
     return $cout;
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:101,代码来源:ImageHelper.php

示例4: 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

示例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


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