Inheritance: extends CI_Controller
Esempio n. 1
0
 public function actionAdd($isFancy = 0)
 {
     $model = new Reviews();
     if (isset($_POST[$this->modelName])) {
         $model->attributes = $_POST[$this->modelName];
         if ($model->validate()) {
             if ($model->save(false)) {
                 $model->name = CHtml::encode($model->name);
                 $model->body = CHtml::encode($model->body);
                 $notifier = new Notifier();
                 $notifier->raiseEvent('onNewReview', $model);
                 if (Yii::app()->user->getState('isAdmin')) {
                     Yii::app()->user->setFlash('success', tt('success_send_not_moderation'));
                 } else {
                     Yii::app()->user->setFlash('success', tt('success_send'));
                 }
                 $this->redirect(array('index'));
             }
             $model->unsetAttributes(array('name', 'body', 'verifyCode'));
         } else {
             Yii::app()->user->setFlash('error', tt('failed_send'));
         }
         $model->unsetAttributes(array('verifyCode'));
     }
     if ($isFancy) {
         $this->excludeJs();
         $this->renderPartial('add', array('model' => $model), false, true);
     } else {
         $this->render('add', array('model' => $model));
     }
 }
Esempio n. 2
0
 public function testGetReviews()
 {
     $params = $this->getParams();
     $_SERVER['HTTP_USER_AGENT'] = "google";
     $obj = new Reviews($params);
     $res = $obj->getReviews();
     $this->assertNotEmpty($res);
 }
 public function testGetAggregateRating()
 {
     $params = $this->getParams();
     $_SERVER['HTTP_USER_AGENT'] = "google";
     $params['content_type'] = "spotlights";
     $obj = new Reviews($params);
     $res = $obj->getAggregateRating();
     $this->assertNotEmpty($res);
 }
Esempio n. 4
0
 public function actionReviews($articleId)
 {
     //获得表单提交的数据
     $face = $_POST["face"];
     $content = $_POST["content"];
     $userName = $_POST["userName"];
     //添加评论
     $reviews = new Reviews();
     $reviews->face = $face;
     $reviews->body = $content;
     $reviews->userName = $userName;
     $reviews->articleId = $articleId;
     $result = $reviews->save();
     $this->redirect(__APP__ . "/success/index/act/addreviews/rst/{$result}/articleId/{$articleId}");
 }
Esempio n. 5
0
 public function pageAction($id = null)
 {
     $member = Members::findFirstById($id);
     $this->view->setVar('member', $member);
     $reviews = Reviews::find(array('member_id = "' . $id . '"', 'order' => 'id DESC'));
     $this->view->setVar('reviews', $reviews);
 }
Esempio n. 6
0
 public function biz_pageAction()
 {
     $member = Members::findFirstById($id);
     $this->view->setVar('member', $member);
     $reviews = Reviews::find(array('member_id = "' . $id . '"', 'order' => 'id DESC'));
     $this->view->setVar('reviews', $reviews);
     $claimRequests = ClaimRequests::find(array('member_id = "' . $id . '"', 'order' => 'id DESC'));
 }
Esempio n. 7
0
 public static function getLastReview()
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'active = ' . self::STATUS_ACTIVE;
     $criteria->limit = 1;
     $criteria->order = 'date_created DESC';
     $lastReview = Reviews::model()->find($criteria);
     return $lastReview;
 }
Esempio n. 8
0
 public function Show($parameters)
 {
     $view = new Zend_View();
     $view->addScriptPath('../library/Shineisp/Custom/views');
     $ns = new Zend_Session_Namespace();
     $languageID = Languages::get_language_id($ns->lang);
     // Generate the xml file in the public path /documents
     Reviews::getXMLDataMap($languageID);
     return $view->render('reviewsmap.phtml');
 }
 public function viewAction($id = null)
 {
     $business = Business::findFirstById($id);
     if (!$business) {
         return $this->response->redirect('review/search_business');
     }
     $this->view->setVar('business', $business);
     $reviews = Reviews::findByBusinessId($id);
     $this->view->setVar('reviews', $reviews);
 }
Esempio n. 10
0
 public function invokeHandler(User $user, RequestData $data)
 {
     $chapid = $data->get("chapid", NULL);
     $itemid = $data->get("sid", 0);
     if ($chapid != NULL && is_numeric($chapid)) {
         return Reviews::getByChapter($itemid, $chapid);
     } else {
         return null;
     }
 }
Esempio n. 11
0
 public function new_eventAction()
 {
     if ($this->request->isPost()) {
         $countryId = $this->request->getPost('country_id');
         $country = Countries::findFirst(array('columns' => '*', 'conditions' => 'id LIKE :id:', 'bind' => array('id' => $countryId)));
         $countryName = '';
         if ($country) {
             $countryName = $country->country;
         }
         $address = str_replace(' ', '+', $this->request->getPost('street') . '+' . $this->request->getPost('city') . '+' . $countryName);
         $userSession = $this->session->get("userSession");
         $content = file_get_contents('https://maps.googleapis.com/maps/api/geocode/json?address=' . $address . '&key=AIzaSyAbpLPfBH8sNdVSzMULD_BZN9qrAqbL3V8');
         $json = json_decode($content, true);
         $lat = $json['results'][0]['geometry']['location']['lat'];
         $lng = $json['results'][0]['geometry']['location']['lng'];
         //error_log('LAT : '.$lat.' LONG : '.$lng);
         $events = new Events();
         $events->created = date('Y-m-d H:i:s');
         $events->modified = date('Y-m-d H:i:s');
         $events->member_id = $userSession['id'];
         $events->name = $this->request->getPost('name');
         $events->website = $this->request->getPost('website');
         $events->telephone = $this->request->getPost('telephone');
         $events->street = $this->request->getPost('street');
         $events->city = $this->request->getPost('city');
         $events->country_id = $this->request->getPost('country_id');
         $events->lat = $lat;
         $events->lng = $lng;
         $events->event_date = $this->request->getPost('eventdate');
         $events->event_category_id = $this->request->getPost('event_category_id');
         $events->eventinfo = $this->request->getPost('eventinfo');
         if ($events->create()) {
             $id = $events->id;
             $this->flash->success('<button type="button" class="close" data-dismiss="alert">×</button>New event has been created');
             if (!empty($this->request->getPost('review'))) {
                 $review = new Reviews();
                 $review->created = date('Y-m-d H:i:s');
                 $review->modified = date('Y-m-d H:i:s');
                 $review->member_id = $userSession['id'];
                 $review->event_id = $events->id;
                 $review->content = $this->request->getPost('review');
                 $review->rate = $this->request->getPost('rate');
                 if ($review->create()) {
                     $this->flash->success('<button type="button" class="close" data-dismiss="alert">×</button>You\'re review has been submitted.');
                 }
             }
             return $this->response->redirect('events/view/' . $id);
         }
     }
     $countries = Countries::find();
     $this->view->setVar('countries', $countries);
     $eventsCategories = EventsCategories::find();
     $this->view->setVar('eventsCategories', $eventsCategories);
 }
Esempio n. 12
0
 public function Show($parameters)
 {
     $view = new Zend_View();
     $view->addScriptPath('../library/Shineisp/Custom/views');
     $limit = 5;
     $ns = new Zend_Session_Namespace();
     $languageID = Languages::get_language_id($ns->lang);
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     if (!empty($parameters['limit']) && is_numeric($parameters['limit'])) {
         $limit = $parameters['limit'];
     }
     $view->data = Reviews::get_random($limit);
     return $view->render('reviewslist.phtml');
 }
Esempio n. 13
0
 public function actionIndex()
 {
     $this->pageTitle = "论坛首页";
     // 论坛公告
     $notices = Notices::model()->find();
     // 讨论区类别
     $bbsType = BbsType::model()->findAll();
     // 话题计数
     $bbsCount = BbsInfo::model()->count();
     // 回帖计数
     $revCount = Reviews::model()->count();
     // 用户计数
     $userCount = UserInfo::model()->count();
     // 绑定数据
     $data = array('notices' => $notices, 'bbsType' => $bbsType, 'bbsCount' => $bbsCount, 'revCount' => $revCount, 'userCount' => $userCount);
     $this->render('index', $data);
 }
Esempio n. 14
0
 public function listAction()
 {
     $ns = new Zend_Session_Namespace();
     $products = array();
     // get the category uri
     $uri = $this->getRequest()->getParam('q');
     if (!empty($uri)) {
         // Save the path of the user
         $ns->lastcategory = $uri;
         // Get the category information
         $category = $this->categories->getAllInfobyURI($uri);
         if (!empty($category[0])) {
             $this->view->category = $category[0];
             // Get the subcategories
             $this->view->subcategory = ProductsCategories::getbyParentId($category[0]['category_id'], 1, true);
             // Set the Metatag information
             $this->view->headTitle()->prepend($category[0]['name']);
             if (!empty($category[0]['keywords'])) {
                 $this->view->headMeta()->setName('keywords', $category[0]['keywords']);
             }
             if (!empty($category[0]['description'])) {
                 $this->view->headMeta()->setName('description', $category[0]['description'] ? Shineisp_Commons_Utilities::truncate(strip_tags($category[0]['description'])) : '-');
             }
             $this->view->headertitle = $category[0]['name'];
             // Get the products information
             $fields = "pd.productdata_id as productdata_id, \n\t\t\t\t           pd.name as name, \n\t\t\t\t           pd.shortdescription as shortdescription, \n\t\t\t\t           pd.metakeywords as metakeywords, \n\t\t\t\t           pd.metadescription as metadescription, \n\t\t\t\t           p.*, pag.code as groupcode";
             $data = $this->categories->getProductListbyCatUri($uri, $fields, $ns->langid);
             if (!empty($data['records'])) {
                 // Get the media information for each product
                 foreach ($data['records'] as $product) {
                     $product['reviews'] = Reviews::countItems($product['product_id']);
                     $product['attributes'] = ProductsAttributes::getAttributebyProductID($product['product_id'], $ns->langid, true);
                     $products[] = $product;
                 }
                 $this->view->products = $products;
                 $this->view->pager = $data['pager'];
             }
             $this->view->layoutmode = !empty($ns->layoutmode) ? $ns->layoutmode : "list";
             $this->_helper->viewRenderer($ns->layoutmode);
         } else {
             $this->_helper->redirector('index', 'index', 'default');
         }
     }
 }
Esempio n. 15
0
 /**
  * @method run
  */
 public function run()
 {
     $reviewsConfig = ReviewsConfig::model()->find();
     $criteria = new CDbCriteria();
     $criteria->order = 'date_create DESC';
     if ($reviewsConfig->premoder and Yii::app()->user->isGuest) {
         $criteria->condition = 'public = :public';
         $criteria->params = array(':public' => true);
     }
     $dataProvider = Reviews::model()->findAll($criteria);
     /*
             $dataProvider = new CActiveDataProvider('Reviews', array(
                 'criteria' => $criteria,
                 'pagination' => false,
             ));
     */
     $this->render('reviews', array('dataProvider' => $dataProvider));
     return parent::run();
 }
Esempio n. 16
0
        echo "\talert('发表评论成功!');";
        echo "\twindow.location='news.php?articleId={$articleId}';";
        echo "</script>";
    } else {
        echo "<script type='text/javascript'>";
        echo "\talert('发表评论失败!');";
        echo "\twindow.location='news.php?articleId={$articleId}';";
        echo "</script>";
    }
}
//获得当前页面显示的新闻
$result3 = NewsArticles::getNewsById($articleId);
//所有分类
$newsTypes = NewsTypes::getNewsTypes();
//获得该新闻的所有评论
$reviews = Reviews::getReviews($articleId);
?>
<html>
  <head>
    <title>天天新闻网</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <link href="css/news.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="kindeditor/kindeditor.js"></script>
	<script type="text/javascript">
	  var editor;//编辑器对象
	  KindEditor.ready(function(e){
		  editor = e.create("[name=content]",{
			  "width":"560px",
			  "height":"200px",
			  "items":["source","|","undo","redo","|","bold","italic","underline"]
		  });
Esempio n. 17
0

<div class="col-xs-12 col-sm-3" >	
<div class="block-left" style="margin-bottom:40px;">
	<?php 
$this->renderPartial('application.views.common.tags');
?>
</div>
</div>
<div class="col-xs-12 col-sm-6 text-center">
	<img class="img-responsive" id="goToNextSlideReview" style="margin:0px auto 0px auto;cursor:pointer;" src="/img/btn-reviews.png" onmouseover="this.src='/img/btn-reviews_active.png'" onmouseout="this.src='/img/btn-reviews.png'" />

	<div class="ex-reviews">
	<ul id="exp-reviews-slider">
	<?php 
$reviews = Reviews::model()->active()->findAll();
if ($reviews) {
    foreach ($reviews as $review) {
        //	$src = $review->getOrigFilePath().$review->image;
        $src = Yii::app()->createAbsoluteUrl($review->getUrl('120x120xC', 'adaptiveResizeQuadrant'));
        ?>
	<li>
	<div class="">
	<div class="ex-review row">
	<div class="col-xs-12 col-sm-3 ex-review-pic">
	<img class="img-responsive" src="<?php 
        echo $src;
        ?>
" />
	</div>
	<div class="col-xs-12 ex-review-text col-sm-9 text-left ">
Esempio n. 18
0
 /**
  * Search products  
  * 
  * @param string $needed
  * @param integer $locale
  * @return ArrayObject
  */
 public static function search($needed, $locale = 1, $retarray = TRUE)
 {
     $data = array();
     $dq = Doctrine_Query::create()->select('p.*, pag.code as groupcode, pd.name as name, pd.shortdescription as shortdescription, pd.metakeywords as keywords, pm.path as imgpath')->from('Products p')->leftJoin("p.ProductsData pd WITH pd.language_id = {$locale}")->leftJoin("p.ProductsMedia pm")->leftJoin("p.ProductsAttributesGroups pag")->where("pd.name like ? and p.enabled = ?", array("%{$needed}%", 1))->orWhere("pd.shortdescription like ?", "%{$needed}%")->orWhere("pd.description like ?", "%{$needed}%")->orWhere("pd.metakeywords like ?", "%{$needed}%")->addWhere("p.isp_id = ?", Isp::getCurrentId());
     if ($retarray) {
         $data = $dq->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
     } else {
         // Create the pagination of the records
         $dq = self::pager($dq, 5);
         // Execute the query
         $products = $dq->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
         foreach ($products as $product) {
             $product['reviews'] = Reviews::countItems($product['product_id']);
             // Add the total of the reviews for each product
             $data['records'][] = ProductsData::checkTranslation($product);
             // Check the product data translation text
         }
         // Get the pager object
         $data['pager'] = $dq->display(null, true);
     }
     return $data;
 }
Esempio n. 19
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Reviews $value A Reviews object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Reviews $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Esempio n. 20
0
 public function viewAction($id = null)
 {
     $business = Business::findFirst($id);
     if (!$business) {
         return $this->response->redirect('review/search_business');
     }
     $averageRate = $business->average_rate;
     $businessCategoryLists = BusinessCategoryLists::find('business_id = "' . $id . '"');
     $businessUpdates = BusinessUpdates::findFirst(array('business_id="' . $id . '"', "order" => "id DESC"));
     if ($businessUpdates) {
         $business = $businessUpdates;
         //$businessCategoryLists = BusinessCategoryListUpdates::find('business_update_id = "'.$businessUpdates->id.'"');
         $business->id = $id;
         $business->average_rate = $averageRate;
     }
     $this->view->setVar('business', $business);
     $this->view->setVar('businessCategoryLists', $businessCategoryLists);
     $businessLastImg = BusinessImages::findFirst(array('business_id = "' . $id . '"', "order" => "id DESC"));
     $this->view->setVar('businessLastImg', $businessLastImg);
     $businessImages = BusinessImages::find(array('business_id = "' . $id . '"', "order" => "id DESC", "limit" => 7));
     $this->view->setVar('businessImages', $businessImages);
     $reviews = Reviews::find(array('business_id = "' . $id . '"', "order" => "id DESC"));
     $this->view->setVar('reviews', $reviews);
     //error_log("WWWWWW ".print_r($businessCategoryLists));
     // $this->view->setVar('businessCategoryLists', $businessCategoryLists);
     // $reviews = Reviews::find('business_id = "'.$id.'"');
     // $this->view->setVar('reviews', $reviews);
 }
Esempio n. 21
0
 public function viewAction($id = null)
 {
     $business = Business::findFirst($id);
     if (!$business) {
         return $this->response->redirect('review/search_business');
     }
     $averageRate = $business->average_rate;
     $businessCategoryLists = BusinessCategoryLists::find('business_id = "' . $id . '"');
     $businessUpdates = BusinessUpdates::findFirst(array('business_id="' . $id . '"', "order" => "id DESC"));
     if ($businessUpdates) {
         $business = $businessUpdates;
         //$businessCategoryLists = BusinessCategoryListUpdates::find('business_update_id = "'.$businessUpdates->id.'"');
         $business->id = $id;
         $business->average_rate = $averageRate;
     }
     $this->view->setVar('business', $business);
     $this->view->setVar('businessCategoryLists', $businessCategoryLists);
     $query = $this->modelsManager->createQuery("SELECT * from BusinessImages where business_id={$id} and primary_pic='yes'");
     //$businessLastImg = $query->execute();
     $businessLastImg = BusinessImages::findFirst(array('business_id="' . $id . '" and primary_pic="Yes"'));
     $businessImgCover = BusinessBackgroundCovers::findFirst(array('business_id="' . $id . '" and primary_pic="Yes"'));
     //$businessLastImg = BusinessImages::findFirst(array('business_id = "'.$id.'"', "order" => "id DESC"));
     $this->view->setVar('businessLastImg', $businessLastImg);
     $businessImages = BusinessImages::find(array('business_id = "' . $id . '"', "order" => "id DESC", "limit" => 7));
     $this->view->setVar('businessImages', $businessImages);
     $reviews = Reviews::find(array('business_id = "' . $id . '"', "order" => "id DESC"));
     $this->view->setVar('reviews', $reviews);
     $this->view->setVar('businessImgCover', $businessImgCover);
     //error_log("WWWWWW ".print_r($businessCategoryLists));
     // $this->view->setVar('businessCategoryLists', $businessCategoryLists);
     // $reviews = Reviews::find('business_id = "'.$id.'"');
     // $this->view->setVar('reviews', $reviews);
 }
Esempio n. 22
0
 /**
  * processAction
  * Update the record previously selected
  * @return unknown_type
  */
 public function processAction()
 {
     $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
     $form = $this->getForm("/admin/reviews/process");
     $request = $this->getRequest();
     // Create the buttons in the edit form
     $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/banks/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/banks/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     // Check if we have a POST request
     if (!$request->isPost()) {
         return $this->_helper->redirector('list', 'reviews', 'admin');
     }
     if ($form->isValid($request->getPost())) {
         // Get the id
         $id = $this->getRequest()->getParam('review_id');
         // Set the new values
         if (is_numeric($id)) {
             $this->reviews = Reviews::getbyId($id);
         }
         // Get the values posted
         $params = $form->getValues();
         $id = Reviews::saveData($params);
         $redirector->gotoUrl("/admin/reviews/edit/id/{$id}");
     } else {
         $this->view->form = $form;
         $this->view->title = $this->translator->translate("Details of the reviews");
         $this->view->description = $this->translator->translate("Here you can check the submitted information.");
         return $this->render('applicantform');
     }
 }
Esempio n. 23
0
    $countPaymentWait = Payments::getCountWait();
    $bagePayments = $countPaymentWait > 0 ? "&nbsp<span class=\"badge\">{$countPaymentWait}</span>" : '';
}
$bageComments = '';
if (issetModule('comments')) {
    $countCommentPending = Comment::getCountPending();
    $bageComments = $countCommentPending > 0 ? "&nbsp<span class=\"badge\">{$countCommentPending}</span>" : '';
}
$bageComplain = '';
if (issetModule('apartmentsComplain')) {
    $countComplainPending = ApartmentsComplain::getCountPending();
    $bageComplain = $countComplainPending > 0 ? "&nbsp<span class=\"badge\">{$countComplainPending}</span>" : '';
}
$bageReviews = '';
if (issetModule('reviews')) {
    $countReviewsPending = Reviews::getCountModeration();
    $bageReviews = $countReviewsPending > 0 ? "&nbsp<span class=\"badge\">{$countReviewsPending}</span>" : '';
}
$bageVacancy = '';
if (issetModule('vacancy')) {
    $countVacancyPending = Vacancy::getCountModeration();
    $bageVacancy = $countVacancyPending > 0 ? "&nbsp<span class=\"badge\">{$countVacancyPending}</span>" : '';
}
$bageBooking = '';
if (issetModule('bookingtable')) {
    $countNewPending = Bookingtable::getCountNew();
    $bageBooking = $countNewPending > 0 ? "&nbsp<span class=\"badge\">{$countNewPending}</span>" : '';
}
$bageMessages = '';
if (issetModule('messages')) {
    $countMessagesUnread = Messages::getCountUnread(Yii::app()->user->id);
Esempio n. 24
0
 /**
  * saveData
  * Save the record
  * @param posted var from the form
  * @return Boolean
  */
 public static function saveData($record, $sendemail = false)
 {
     // Set the new values
     if (!empty($record['review_id']) && is_numeric($record['review_id'])) {
         $review = self::getbyId($record['review_id']);
     } else {
         $review = new Reviews();
         $review->ip = $_SERVER['REMOTE_ADDR'];
     }
     // Get the latitude and longitude coordinates
     $coords = Shineisp_Commons_Utilities::getCoordinates($record['city']);
     $review->product_id = $record['product_id'];
     $review->publishedat = date('Y-m-d H:i:s');
     $review->nick = $record['nick'];
     $review->city = !empty($coords['results'][0]['formatted_address']) ? $coords['results'][0]['formatted_address'] : $record['city'];
     $review->referer = $record['referer'];
     $review->subject = $record['subject'];
     $review->latitude = !empty($coords['results'][0]['geometry']['location']['lat']) ? $coords['results'][0]['geometry']['location']['lat'] : $record['latitude'];
     $review->longitude = !empty($coords['results'][0]['geometry']['location']['lng']) ? $coords['results'][0]['geometry']['location']['lng'] : $record['longitude'];
     $review->email = $record['email'];
     $review->stars = $record['stars'];
     $review->active = isset($record['active']) ? $record['active'] : 0;
     $review->review = $record['review'];
     if ($review->trySave()) {
         if ($sendemail) {
             // Send the email to confirm the subscription
             $isp = Isp::getActiveISP();
             $placeholders['review'] = $record['review'];
             $placeholders['nick'] = $record['nick'];
             $placeholders['referer'] = $record['referer'];
             $placeholders['subject'] = $record['subject'];
             $placeholders['email'] = $record['email'];
             $placeholders['stars'] = $record['stars'];
             $placeholders['product'] = products::getAllInfo($record['product_id']);
             // Send a message to the administrator
             Shineisp_Commons_Utilities::sendEmailTemplate($isp['email'], 'review_new', $placeholders);
         }
         return $review->review_id;
     }
     return false;
 }
Esempio n. 25
0
 /**
  * Create a new widget for the dashboard
  */
 public function widgetsAction()
 {
     $auth = Zend_Auth::getInstance();
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $auth->setStorage(new Zend_Auth_Storage_Session('admin'));
     $id = $this->getRequest()->getParam('id', 'widget_' . rand());
     $icon = $this->getRequest()->getParam('icon', 'fa fa-file');
     $type = $this->getRequest()->getParam('type');
     $title = $this->getRequest()->getParam('title');
     $buttons = array();
     if (!empty($id)) {
         $widget = new Shineisp_Commons_Widgets();
         $widget->setId($id);
         // Ajax load of the widgets
         // Get only the new orders
         if ($type == "new_order_widget") {
             $records = Orders::Last(array(Statuses::id("tobepaid", "orders")));
             $buttons = array('edit' => array('label' => $translator->translate('Edit'), 'cssicon' => 'glyphicon glyphicon-pencil', 'action' => "/admin/orders/edit/id/%d"));
             $widget->setBasepath('/admin/orders/')->setIdxfield($records['index'])->setButtons($buttons);
             // Get all the pending, processing, and paid orders to be complete
         } elseif ($type == 'processing_order_widget') {
             $statuses = array(Statuses::id("processing", "orders"), Statuses::id("pending", "orders"), Statuses::id("paid", "orders"));
             $buttons = array('edit' => array('label' => $translator->translate('Edit'), 'cssicon' => 'glyphicon glyphicon-pencil', 'action' => "/admin/orders/edit/id/%d"));
             $records = Orders::Last($statuses);
             $widget->setBasepath('/admin/orders/')->setIdxfield($records['index'])->setButtons($buttons);
             // Get all the services / order items next to the expiration date from -10 days to 30 days
         } elseif ($type == 'recurring_services_widget') {
             $records = OrdersItems::getServices();
             $buttons = array('edit' => array('label' => $translator->translate('Edit'), 'cssicon' => 'glyphicon glyphicon-pencil', 'action' => "/admin/ordersitems/edit/id/%d"));
             $widget->setBasepath('/admin/ordersitems/')->setIdxfield($records['index'])->setButtons($buttons);
             // Get the last 5 tickets opened by the customers
         } elseif ($type == 'last_tickets_widget') {
             $records = Tickets::Last(null, 5);
             $buttons = array('edit' => array('label' => $translator->translate('Edit'), 'cssicon' => 'glyphicon glyphicon-pencil', 'action' => "/admin/tickets/edit/id/%d"));
             $widget->setBasepath('/admin/tickets/')->setIdxfield($records['index'])->setButtons($buttons);
             // get the last domain tasks to be executed
         } elseif ($type == 'last_domain_tasks_widget') {
             $records = DomainsTasks::Last();
             $buttons = array('edit' => array('label' => $translator->translate('Edit'), 'cssicon' => 'glyphicon glyphicon-pencil', 'action' => "/admin/domainstasks/edit/id/%d"));
             $widget->setBasepath('/admin/domainstasks/')->setIdxfield($records['index'])->setButtons($buttons);
             // get the last ISP panel tasks to be executed
         } elseif ($type == 'last_panel_tasks_widget') {
             $records = PanelsActions::Last();
             $buttons = array('edit' => array('label' => $translator->translate('Edit'), 'cssicon' => 'glyphicon glyphicon-pencil', 'action' => "/admin/panelsactions/edit/id/%d"));
             $widget->setBasepath('/admin/panelsactions/')->setIdxfield($records['index'])->setButtons($buttons);
             // get the domains next the expiration date
         } elseif ($type == 'expiring_domain_widget') {
             // Create the header table columns
             $records['fields'] = array('expiringdate' => array('label' => $translator->translate('Expiry Date')), 'domains' => array('label' => $translator->translate('Domain')), 'days' => array('label' => $translator->translate('Days left')));
             $buttons = array('edit' => array('label' => $translator->translate('Edit'), 'cssicon' => 'glyphicon glyphicon-pencil', 'action' => "/admin/domains/edit/id/%d"));
             $records['data'] = Domains::getExpiringDomains(null, 107, -1, 5);
             $records['index'] = "domain_id";
             $widget->setBasepath('/admin/domains/')->setIdxfield($records['index'])->setButtons($buttons);
             // get the messages/notes posted by the customers within the orders
         } elseif ($type == 'order_messages_widget') {
             $records = Messages::Last('orders');
             $buttons = array('edit' => array('label' => $translator->translate('Edit'), 'cssicon' => 'glyphicon glyphicon-pencil', 'action' => "/admin/orders/edit/id/%d"));
             $widget->setBasepath('/admin/orders/')->setIdxfield($records['index'])->setButtons($buttons);
             // get the messages/notes posted by the customers within the domain
         } elseif ($type == 'domain_messages_widget') {
             $records = Messages::Last('domains');
             $buttons = array('edit' => array('label' => $translator->translate('Edit'), 'cssicon' => 'glyphicon glyphicon-pencil', 'action' => "/admin/domains/edit/id/%d"));
             $widget->setBasepath('/admin/domains/')->setIdxfield($records['index'])->setButtons($buttons);
             // get the list of your best customers
         } elseif ($type == 'customers_parade_widget') {
             $buttons = array('edit' => array('label' => $translator->translate('Show'), 'cssicon' => 'glyphicon glyphicon-pencil', 'action' => "/admin/customers/edit/id/%d"));
             $records = Customers::Hitparade();
             $widget->setBasepath('/admin/customers/')->setIdxfield($records['index'])->setButtons($buttons);
             // get the customer status summary
         } elseif ($type == 'customer_summary_widget') {
             $records = Customers::summary();
             // get the tickets summary
         } elseif ($type == 'ticket_summary_widget') {
             $records = Tickets::summary();
             // get the domains summary
         } elseif ($type == 'summary_domains_widget') {
             $records = Domains::summary();
             // get the product reviews stats
         } elseif ($type == 'product_reviews_widget') {
             $records = Reviews::summary();
             // get the bestseller product stats
         } elseif ($type == 'bestseller_widget') {
             $buttons = array('edit' => array('label' => $translator->translate('Show'), 'cssicon' => 'glyphicon glyphicon-pencil', 'action' => "/admin/products/edit/id/%d"));
             $records = Products::summary();
             $widget->setBasepath('/admin/products/')->setIdxfield($records['index'])->setButtons($buttons);
             // get the last ISP notes
         } elseif ($type == 'notes_widget') {
             $user = $auth->getIdentity();
             $records = Notes::summary($user['user_id']);
             $widget->setBasepath('/admin/notes/');
         } else {
             die('No widget type has been selected: ' . $type);
         }
         // Records Builtin columns. The code get the field names as header column name
         if (!empty($records['fields'])) {
             foreach ($records['fields'] as $field => $column) {
                 $column['alias'] = !empty($column['alias']) ? $column['alias'] : $field;
                 $widget->setColumn($field, $column);
             }
         }
         if (!empty($records['data'])) {
             $widget->setIcon($icon)->setLabel($title)->setRecords($records['data']);
             die($widget->create());
         }
     }
     die;
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Zal the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Reviews::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Esempio n. 27
0
		<div class="col-sm-10">
		<?php 
echo $form->textArea($model, 'title', array('class' => 'form-control', 'placeholder' => 'Подпись'));
?>
		<?php 
echo $form->error($model, 'title');
?>
		</div>
	</div>
	<div class="form-group">
                <?php 
echo $form->labelEx($model, 'status', array('class' => 'col-sm-2 control-label'));
?>
                <div class="col-sm-10">
                <?php 
echo $form->dropDownList($model, 'status', Reviews::getStatusNames(), array('encode' => false, 'class' => 'form-control', 'options' => array(Reviews::STATUS_ACTIVE => array('selected' => 'selected'))));
?>
                </div>
        </div>

     <div class="form-group">
	   <?php 
CHtml::$afterRequiredLabel = ' <span class="text-danger">*</span>';
?>
		<?php 
echo $form->labelEx($model, 'image', array('class' => 'col-sm-2 control-label'));
?>
		<div class="col-sm-10">
		<?php 
$this->widget('ext.dropzone.EDropzone', array('id' => 'part' . $model->id, 'model' => $model, 'name' => 'image', 'attribute' => 'image', 'formId' => 'reviews-form', 'sizeLimit' => $sizeLimit, 'deleteFile' => Yii::app()->createAbsoluteUrl('/admin/reviews/deletefile'), 'unlinkFile' => Yii::app()->createAbsoluteUrl('/file/upload/unlink', array('uploadsession' => $this->uploadsession)), 'url' => $this->createAbsoluteUrl('/file/upload/upload', array('inputName' => 'image', 'uploadsession' => $this->uploadsession)), 'options' => array()));
?>
Esempio n. 28
0
 public function respondAction($review_id = null, $business_id = null)
 {
     $userSession = $this->session->get("userSession");
     if ($this->request->isPost()) {
         $biz_id = $this->request->getPost("business_id");
         $respond = new ReviewResponds();
         $respond->created = date('Y-m-d H:i:s');
         $respond->modified = date('Y-m-d H:i:s');
         $respond->member_id = $userSession['id'];
         $respond->review_id = $this->request->getPost("review_id");
         $respond->business_id = $this->request->getPost("business_id");
         $respond->content = $this->request->getPost("content");
         if ($respond->create()) {
             return $this->response->redirect('business/view/' . $biz_id);
         } else {
             $this->view->disable();
             print_r($respond->getMessages());
         }
     }
     $business = Business::findFirstById($business_id);
     if (!$business) {
         return $this->response->redirect('review/search_business');
     }
     $this->view->setVar('business', $business);
     $reviews = Reviews::findById($review_id);
     if (!$reviews) {
         $this->view->disable();
         echo "failed";
     }
     $this->view->setVar('reviews', $reviews);
 }
Esempio n. 29
0
 /**
  * 删除评论,此评论只有超级管理员能删除
  * @param  [int] $reId  [评论Id]
  * @param  [int] $bbsId [论坛话题ID]
  */
 public function actiondelReview($reId, $bbsId)
 {
     $result = Reviews::model()->deleteByPK("{$reId}");
     $this->redirect("index.php?r=reaction/index/act/delReview/rst/{$result}/bbsId/{$bbsId}");
 }
Esempio n. 30
0
 /**
  * addreviewAction
  * Create the form for the submittion of the review
  */
 public function addreviewAction()
 {
     $ns = new Zend_Session_Namespace();
     $this->getHelper('layout')->setLayout('1column');
     $request = $this->getRequest();
     $uri = $request->getParam('q');
     if (!empty($uri)) {
         $product = Products::getProductbyUriID($uri, null, $ns->langid);
         if (is_array($product)) {
             $this->view->product = $product;
             $form = $this->ReviewForm($uri);
             // Check if we have a POST request
             if ($request->isPost()) {
                 if ($form->isValid($request->getPost())) {
                     if (Reviews::saveData($form->getValues(), true)) {
                         return $this->_helper->redirector('get', 'products', 'default', array('q' => $product['uri']));
                     }
                 }
             }
             $form->populate(array('product_id' => $product['product_id']));
             $this->view->reviewform = $form;
         }
     } else {
         return $this->_helper->redirector('index', 'index', 'default');
     }
     $this->_helper->viewRenderer('reviews');
 }