public function indexAction() { // Get, check and setup the parameters if (!($widget_id = $this->getRequest()->getParam("id"))) { throw new Stuffpress_Exception("No widget id provided to the widget controller"); } // Verify if the requested widget exist and get its data $widgets = new Widgets(); if (!($widget = $widgets->getWidget($widget_id))) { throw new Stuffpress_Exception("Invalid widget id"); } // Get the user $users = new Users(); $user = $users->getUser($widget['user_id']); // Get all sources configured for that user $properties = new Properties(array(Properties::KEY => $user->id)); // Get the bio data // User profile $this->view->username = $user->username; $this->view->first_name = $properties->getProperty('first_name'); $this->view->last_name = $properties->getProperty('last_name'); $this->view->bio = $properties->getProperty('bio'); $this->view->location = $properties->getProperty('location'); $this->view->avatar = $properties->getProperty('avatar_image'); // Get the widget properties $properties = new WidgetsProperties(array(Properties::KEY => $widget_id)); $title = $properties->getProperty('title'); $this->view->title = $title ? $title : "About {$user->username}"; }
public function indexAction() { // Get, check and setup the parameters if (!($widget_id = $this->getRequest()->getParam("id"))) { throw new Stuffpress_Exception("No widget id provided to the widget controller"); } // Verify if the requested widget exist and get its data $widgets = new Widgets(); if (!($widget = $widgets->getWidget($widget_id))) { throw new Stuffpress_Exception("Invalid widget id"); } // Get the last comments $comments = new Comments(array(Stuffpress_Db_Table::USER => $widget['user_id'])); $mycomments = $comments->getLastComments(); $data = new Data(); // Prepare the comments for output foreach ($mycomments as &$comment) { $time = strtotime($comment['timestamp']); $item = $data->getItem($comment['source_id'], $comment['item_id']); $comment['item'] = $item; $comment['when'] = Stuffpress_Date::ago($time, "j M y"); $comment['comment'] = str_replace("\n", " ", $comment['comment']); if (strlen($comment['comment']) > 50) { $comment['comment'] = mb_substr($comment['comment'], 0, 47) . "..."; } } // Get the widget properties $properties = new WidgetsProperties(array(Properties::KEY => $widget_id)); $title = $properties->getProperty('title'); $this->view->title = $title ? $title : "Latest comments"; // Prepare the view for rendering $this->view->comments = $mycomments; }
public function indexAction() { // Get, check and setup the parameters if (!($widget_id = $this->getRequest()->getParam("id"))) { throw new Stuffpress_Exception("No widget id provided to the widget controller"); } // Verify if the requested widget exist and get its data $widgets = new Widgets(); if (!($widget = $widgets->getWidget($widget_id))) { throw new Stuffpress_Exception("Invalid widget id"); } // Get the widget properties $properties = new WidgetsProperties(array(Properties::KEY => $widget_id)); $title = $properties->getProperty('title'); $this->view->title = $title ? $title : "Tag cloud"; // Get the archives $db_tags = new Tags(array(Stuffpress_Db_Table::USER => $widget['user_id'])); if ($tags = $db_tags->getTopTags(20)) { $max = $tags[0]['count']; $min = $tags[count($tags) - 1]['count']; sort($tags); $this->view->tags = $tags; $this->view->max = $max; $this->view->min = $min; } }
function loadWidget($widget, $params = array()) { if (strlen($widget) <= 0) { return; } if (!Widgets::isEnabled($widget)) { return; } $widget = str_replace(".", "/", str_replace("/", "", $widget)); $cachePath = _metaCache("WIDGETS", $widget); if (!$cachePath) { $path = getAllWidgetsFolders(); foreach ($path as $a) { $f1 = ROOT . $a . $widget . "/index.php"; $f2 = ROOT . $a . $widget . ".php"; if (file_exists($f1)) { _metaCacheUpdate("WIDGETS", $widget, $f1); Widgets::printWidget($widget, $f1, $params); return false; } elseif (file_exists($f2)) { _metaCacheUpdate("WIDGETS", $widget, $f2); Widgets::printWidget($widget, $f2, $params); return false; } } if (MASTER_DEBUG_MODE == 'true') { trigger_logikserror("Widget Not Found :: " . $widget, E_LOGIKS_ERROR, 404); } } else { Widgets::printWidget($widget, $cachePath, $params); return false; } }
function __construct($path) { $chanbar = ' <ul> <li id="settings" class="option"><a href="#" class="button">settings</a></li> <li id="files" class="option"><a href="#" class="button">files</a></li> <li id="people" class="option"><a href="#" class="button">people</a></li> </ul> '; $user = Auth::user(); $curchan = DB::get()->val('SELECT name from channels where user_id = :user_id AND active = 1', array('user_id' => $user->id)); if ($curchan == '') { $curchan = 'bar'; } $widgets = Widgets::get_widgets(); $components = array('title' => 'Barchat Home', 'path' => $path, 'chanbar' => $chanbar, 'user_id' => Auth::user_id(), 'username' => $user->username, 'nickname' => $user->nickname, 'session_key' => $user->session_key, 'cur_chan' => addslashes($curchan), 'widgets' => $widgets); $v = new View($components); Plugin::call('reload', $user); //check for user agent $useragent = $_SERVER['HTTP_USER_AGENT']; // if (preg_match('/ip(hone|od|ad)/i', $useragent)) { $v->render('template-ios'); } else { $v->render('template'); } }
public static function me() { if (is_null(self::$instance)) { self::$instance = new Widgets(); } return self::$instance; }
/** * The index action is the default action of this Wall Module. It prepares the widget * wall of the user and render the view according to its preferences. * * If the current user is not authenticated, it will be redirected to the users/index * action that will allows you to acces the login form of the application. * */ public function index($continuePurchase = false, $langage = null, $forcebrowser = false) { # Try to force users to use firefox // if(isset($_SESSION['forcebrowser']) && $_SESSION['forcebrowser'] == true){ // $forcebrowser = true; // } // if(!ereg("Firefox/",$_SERVER['HTTP_USER_AGENT']) && !$forcebrowser){ // require(DefaultFC::getView('compatibility.tpl')); // die(); // }else{ // $_SESSION['forcebrowser'] = true; // } if (Auth::isAuth()) { // Determine if the 'category widget' is installed. if (Widgets::isInstalled('categoryList')) { $widgetCategory = array('id' => 'categoryList', 'name' => 'Widget Categories'); } // Determine if the 'tag cloud widget' is installed. if (Widgets::isInstalled('tagCloud')) { $widgetCloud = array('id' => 'tagCloud', 'name' => 'Widget Tag Cloud'); } // Determine if the view must allow the user to manage widgets. $widgetManagement = false; if (Auth::isAdmin() || Auth::isGod()) { $widgetManagement = true; } // Determine if the view must show the list of installed widgets or // a link to the PALETTE Service Browser. $useServiceBrowser = USE_SERVICE_BROWSER; $serviceBrowserURI = USE_SERVICE_BROWSER ? SERVICE_BROWSER_URI . 'index.php/Services/Widgets?num=1' : null; require DefaultFC::getView('index.tpl'); } else { DefaultFC::redirection('users/index?ref=wall'); } }
public function indexAction() { // Get, check and setup the parameters if (!($widget_id = $this->getRequest()->getParam("id"))) { throw new Stuffpress_Exception("No widget id provided to the widget controller"); } // Verify if the requested widget exist and get its data $widgets = new Widgets(); if (!($widget = $widgets->getWidget($widget_id))) { throw new Stuffpress_Exception("Invalid widget id"); } // Get the widget properties $properties = new WidgetsProperties(array(Properties::KEY => $widget_id)); $this->view->title = $properties->getProperty('title'); $this->view->content = $properties->getProperty('content'); }
function manager() { if (!$this->manager instanceof Widgets) { $this->manager = Widgets::instance(); } return $this->manager; }
public function deleteAction() { // Get, check and setup the parameters $widget_id = $this->getRequest()->getParam("id"); // Do we own the widget ? $widgets = new Widgets(); if (!($widget = $widgets->getWidget($widget_id))) { throw new Stuffpress_Exception("Unknown widget with id {$widget_id}"); } if ($widget['user_id'] != $this->_application->user->id) { throw new Stuffpress_AccessDeniedException("Not the owner of widget {$widget_id}"); } $widgets->deleteWidget($widget_id); // Delete the widget properties $properties = new WidgetsProperties(array(Properties::KEY => $widget_id)); $properties->deleteAllProperties(); return $this->_helper->json->sendJson(false); }
public function action_index() { $this->before('oc-panel/pages/widgets/main'); //template header $this->template->title = __('Widgets'); Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Widgets'))); $this->template->scripts['footer'][] = 'js/jquery-sortable-min.js'; $this->template->scripts['footer'][] = 'js/oc-panel/widgets.js'; $this->template->widgets = Widgets::get_widgets(); $this->template->placeholders = Widgets::get_placeholders(); }
/** * Constructor, globally sets region and format * * @param $region * @param $format */ public function __construct($region, $format) { // Store the region locally $this->_region = $region; // Store the format locally $this->_format = $format; // Load the widgets from database $this->load(); // Store the widgets instance Widgets::$instance = $this; }
public static function load() { if (!($loadCache = self::loadCache())) { $themePath = System::getThemePath(); $filePath = $themePath . 'widgets.php'; if (file_exists($filePath)) { include $filePath; } } self::$widgetData = $loadCache; }
public function indexAction() { // Get, check and setup the parameters if (!($widget_id = $this->getRequest()->getParam("id"))) { throw new Stuffpress_Exception("No widget id provided to the widget controller"); } // Verify if the requested widget exist and get its data $widgets = new Widgets(); if (!($widget = $widgets->getWidget($widget_id))) { throw new Stuffpress_Exception("Invalid widget id"); } // Get all sources configured for that user $sources = new Sources(array(Stuffpress_Db_Table::USER => $widget['user_id'])); $mysources = $sources->getSources(); // If sources are configured, get the links for each source $links = array(); if ($mysources) { foreach ($mysources as $source) { if (!($source['public'] && $source['enabled'])) { continue; } if ($source['service'] == 'stuffpress') { continue; } $model = SourceModel::newInstance($source['service']); $model->setSource($source); $link['prefix'] = $model->getServicePrefix(); $link['url'] = $model->getServiceURL(); $link['name'] = $model->getTitle(); $links[] = $link; } } // Get the widget properties $properties = new WidgetsProperties(array(Properties::KEY => $widget_id)); $title = $properties->getProperty('title'); $this->view->title = $title ? $title : "My 2.0 Life"; // Prepare the view for rendering $this->view->links = $links; }
public function indexAction() { // Get, check and setup the parameters if (!($widget_id = $this->getRequest()->getParam("id"))) { throw new Stuffpress_Exception("No widget id provided to the widget controller"); } // Verify if the requested widget exist and get its data $widgets = new Widgets(); if (!($widget = $widgets->getWidget($widget_id))) { throw new Stuffpress_Exception("Invalid widget id"); } // Get the user $users = new Users(); $user = $users->getUser($widget['user_id']); // Get all sources configured for that user $properties = new Properties(array(Properties::KEY => $user->id)); // Get the friendconnect data $this->view->googlefc = $properties->getProperty('googlefc'); // Get the widget properties $properties = new WidgetsProperties(array(Properties::KEY => $widget_id)); $title = $properties->getProperty('title'); $this->view->title = $title; }
public function indexAction() { // Get, check and setup the parameters if (!($widget_id = $this->getRequest()->getParam("id"))) { throw new Stuffpress_Exception("No widget id provided to the widget controller"); } // Verify if the requested widget exist and get its data $widgets = new Widgets(); if (!($widget = $widgets->getWidget($widget_id))) { throw new Stuffpress_Exception("Invalid widget id"); } // Get the widget properties $properties = new WidgetsProperties(array(Properties::KEY => $widget_id)); $title = $properties->getProperty('title'); $this->view->title = $title ? $title : "Archives"; // Get the archives $data = new Data(array(Stuffpress_Db_Table::USER => $widget['user_id'])); $archives = $data->getItemsPerMonth(); // Prepare the view for rendering $this->view->archives = $archives; // Add the required javascript $this->view->headScript()->appendFile('js/accordion/init.js'); }
public function indexAction() { // Get, check and setup the parameters if (!($widget_id = $this->getRequest()->getParam("id"))) { throw new Stuffpress_Exception("No widget id provided to the widget controller"); } // Verify if the requested widget exist and get its data $widgets = new Widgets(); if (!($widget = $widgets->getWidget($widget_id))) { throw new Stuffpress_Exception("Invalid widget id"); } // Get the basename $host = trim(Zend_Registry::get("host"), '/'); // Get the user $users = new Users(); $user = $users->getUser($widget['user_id']); $username = $user->username; // Get the widget properties $properties = new WidgetsProperties(array(Properties::KEY => $widget_id)); $title = $properties->getProperty('title'); $this->view->title = $title ? $title : "Subscribe to my lifestream"; // RSS Link $this->view->feed = "http://{$host}/rss/feed.xml"; }
public function signupAction() { if (!$this->getRequest()->isPost()) { $this->addErrorMessage("Form was not properly posted."); $this->_forward('index'); } // Retrieve the form values and its values $form = $this->getForm(); $valid = $form->isValid($_POST); $values = $form->getValues(); $username = $values['username']; $email = $values['email']; $password = $values['password']; // Validate the form itself if (!$form->isValid($_POST)) { // Failed validation; redisplay form $this->view->form = $form; $this->addErrorMessage("Your form contains some errors, please correct them and submit this form again"); return $this->_forward('register'); } // Register user $users = new Users(); $user = $users->addUser($username, $password, $email); // Add some default widgets to the user $widgets = new Widgets(array(Stuffpress_Db_Table::USER => $user->id)); $widgets->addWidget('search'); $widgets->addWidget('rsslink'); $widgets->addWidget('links'); $widgets->addWidget('lastcomments'); $widgets->addWidget('archives'); $widgets->addWidget('logo'); // Add some default properties $properties = new Properties(array(Stuffpress_Db_Properties::KEY => $user->id)); $properties->setProperty('theme', 'clouds'); $properties->setProperty('title', ucfirst($username)); $properties->setProperty('subtitle', "my life online"); // Add the storytlr data source StuffpressModel::forUser($user->id); // Add default pages $pages = new Pages(array(Stuffpress_Db_Table::USER => $user->id)); //$pages->addPage('dashboard', 'Home'); $pages->addPage('lifestream', 'Stream'); $pages->addPage('stories', 'Stories'); // Send the user a verification email Stuffpress_Emails::sendWelcomeEmail($email, $username, $password, $user->token); // Done ! $this->view->username = $username; $this->view->email = $email; $this->render('success'); }
/** * returns all the widgets * @param bool $only_names, returns only an array with the widgets names, if not array with widgets instances * @return array */ public static function get_widgets($only_names = FALSE) { $widgets = array(); Widgets::$default_widgets = self::get_installed_widgets(); //merge the possible widgets of the theme $list = array_unique(array_merge(widgets::$default_widgets, widgets::$theme_widgets)); if ($only_names) { return $list; } //creating an instance of each widget foreach ($list as $widget_name) { if (class_exists($widget_name)) { $widgets[] = new $widget_name(); } } return $widgets; }
public function getWidgets() { if (!($result = $this->cacheLoad('Widgets_getWidgets_' . $this->_user))) { $sql = "SELECT * FROM `widgets` " . "WHERE user_id = :user_id " . "ORDER BY position "; $data = array("user_id" => $this->_user); $stmt = $this->_db->query($sql, $data); $rows = $stmt->fetchAll(); $result = array(); foreach ($rows as $row) { $widget = Widgets::getModel($row['prefix']); $widget['id'] = $row['id']; $widget['user_id'] = $row['user_id']; $result[] = $widget; } $this->cacheSave($result, 'Widgets_getWidgets_' . $this->_user); } return $result; }
function paginate($arguments = null, $items_per_page = 10, $current_page = 1) { if (isset ( $this ) && instance_of ( $this, 'Widgets' )) { return parent::paginate ( $arguments, $items_per_page, $current_page ); } else { return Widgets::instance ()->paginate ( $arguments, $items_per_page, $current_page ); } }
if ($ok == TRUE) { ?> <div class="receipt-main-wrap"> <h3><?php echo Yii::t("default", "Thank You"); ?> </h3> <p><?php echo Yii::t("default", "Your order has been placed."); ?> </p> <div class="receipt-wrap order-list-wrap"> <?php echo Widgets::receiptLogo(); ?> <h4><?php echo Yii::t("default", "Order Details"); ?> </h4> <div class="input-block"> <div class="label"><?php echo Yii::t("default", "Customer Name"); ?> :</div> <div class="value"><?php echo $data['full_name']; ?>
public function getCssStyle() { $result = array(); $fileName = $this->getName() . ".css"; $cssStyle = \Widgets::getInstance()->readCSS($fileName); if ($cssStyle && $cssStyle != "") { $result[get_class($this)] = $cssStyle; } if ($this->widgets) { foreach ($this->widgets as $widget) { $result = array_merge($result, $widget->getCssStyle()); //echo "loop " . get_class($widget) . "<br>"; //var_dump($result); } } //echo "getCssStyle " . get_class($this) . "<br>"; //var_dump($result); return $result; }
</div> </header> <!-- ########## Navbar end ########## --> <!-- ########## template / container start ########## --> <main id="content" class="welcome-main" role="main"> <?php include Kohana::find_file('views', 'welcome'); ?> </main> <!-- ########## template / container end ########## --> <!-- ########## Footer start ########## --> <footer class="footer" role="contentinfo"> <?php $footer = Widgets::instance()->render('footer', 'footer'); ?> <?php if ($footer) { ?> <div class="extra"> <div class="container"> <div class="row"> <?php echo $footer; ?> </div> </div> </div> <?php }
if ($disabled_website_ordering == "") { ?> <div class="grid-2 left right-menu-content"> <div class="scroll-parent2"> <div class="order-list-wrap scroll-child2"> <h5><?php echo Yii::t("default", "Your Order"); ?> </h5> <div class="item-order-wrap"></div> <!--END item-order-wrap--> <!--VOUCHER STARTS HERE--> <?php Widgets::applyVoucher($merchant_id); ?> <!--VOUCHER STARTS HERE--> <?php $minimum_order = Yii::app()->functions->getOption('merchant_minimum_order', $merchant_id); ?> <?php if (!empty($minimum_order)) { ?> <?php echo CHtml::hiddenField('minimum_order', unPrettyPrice($minimum_order)); echo CHtml::hiddenField('minimum_order_pretty', displayPrice(baseCurrency(), prettyFormat($minimum_order))); ?> <p class="uk-text-muted"><?php echo Yii::t("default", "Subtotal must exceed");
<div class="modal-body"> <div class="progress progress-striped active"> <div class="progress-bar" style="width: 100%"></div> </div> </div> </div> </div> </div> </div> </div> <?php if (count(Widgets::render('publish_new')) > 0) { ?> <div class="col-md-3 col-sm-12 col-xs-12"> <?php foreach (Widgets::render('publish_new') as $widget) { ?> <div class="panel panel-sidebar <?php echo get_class($widget->widget); ?> "> <?php echo $widget; ?> </div> <?php } ?> </div> <?php }
<div class="left main_content"> <div class="inner"> <div class="breadcrumbs"> <div class="inner"> <h2 class="uk-h2"><?php echo $this->crumbsTitle; ?> </h2> <?php Widgets::smsBalance(); ?> <?php Widgets::FaxBalance(); ?> <?php Widgets::languageBar("merchant", true); ?> </div> </div> <!--breadcrumbs--> <div class="content_wrap"> <?php echo $content; ?> </div> </div> <!--INNER--> </div> <div class="clear"></div> </div> <!--END main_wrapper-->
<?php if (isset($_GET['id'])) { if (!($data = Yii::app()->functions->getAddonCategory2($_GET['id']))) { echo "<div class=\"uk-alert uk-alert-danger\">" . Yii::t("default", "Sorry but we cannot find what your are looking for.") . "</div>"; return; } } ?> <?php if (Yii::app()->functions->multipleField() == 2) { ?> <?php Widgets::multipleFields(array('AddOn Name', 'Description'), array('subcategory_name', 'subcategory_description'), $data, array(true, false)); ?> <div class="spacer"></div> <?php } else { ?> <div class="uk-form-row"> <label class="uk-form-label"><?php echo Yii::t("default", "AddOn Name"); ?> </label> <?php echo CHtml::textField('subcategory_name', isset($data['subcategory_name']) ? $data['subcategory_name'] : "", array('class' => 'uk-form-width-large', 'data-validation' => "required")); ?> </div>
public function searchArea() { $resto_cuisine = ''; $rating = ''; $minimum = ''; $pay_by = ''; $minus_has_delivery_rates = 0; $cuisine_list = Yii::app()->functions->Cuisine(true); $country_list = Yii::app()->functions->CountryList(); $this->data['s'] = isset($this->data['s']) ? $this->data['s'] : ""; $search_str = explode(",", $this->data['s']); if (is_array($search_str) && count($search_str) >= 2) { $city = isset($search_str[1]) ? trim($search_str[1]) : ''; $state = isset($search_str[2]) ? trim($search_str[2]) : ''; } else { $city = trim($this->data['s']); $state = trim($this->data['s']); } $from_address = $this->data['s']; if (empty($from_address)) { $from_address = isset($this->data['st']) ? $this->data['st'] : ''; if (!empty($this->data['st'])) { $_SESSION['kr_search_address'] = $this->data['st']; } } if ($res = Yii::app()->functions->searchByArea($city, $state)) { if (is_array($res) && count($res) >= 1) { $total = Yii::app()->functions->search_result_total; $feed_datas['sEcho'] = $this->data['sEcho']; $feed_datas['iTotalRecords'] = $total; $feed_datas['iTotalDisplayRecords'] = $total; /*dump($feed_datas); die();*/ foreach ($res as $val) { $merchant_address = $val['street'] . " " . $val['city'] . " " . $val['post_code']; $miles = 0; $kms = 0; $ft = false; $new_distance_raw = 0; if ($distance = getDistance($from_address, $merchant_address, $val['country_code'], false)) { $miles = $distance->rows[0]->elements[0]->distance->text; //dump($miles); if (preg_match("/ft/i", $miles)) { $ft = true; $miles_raw = $miles; $new_distance_raw = str_replace("ft", '', $miles); $new_distance_raw = ft2kms(trim($new_distance_raw)); } else { $miles_raw = str_replace(array(" ", "mi"), "", $miles); $kms = miles2kms(unPrettyPrice($miles_raw)); $new_distance_raw = $kms; $kms = standardPrettyFormat($kms); } } /*get merchant distance */ $mt_delivery_miles = Yii::app()->functions->getOption("merchant_delivery_miles", $val['merchant_id']); $merchant_distance_type = Yii::app()->functions->getOption("merchant_distance_type", $val['merchant_id']); /*dump($mt_delivery_miles); dump($miles_raw);*/ $resto_cuisine = ''; $cuisine = !empty($val['cuisine']) ? (array) json_decode($val['cuisine']) : false; if ($cuisine != false) { foreach ($cuisine as $valc) { if (array_key_exists($valc, (array) $cuisine_list)) { $resto_cuisine .= $cuisine_list[$valc] . ", "; } } $resto_cuisine = !empty($resto_cuisine) ? substr($resto_cuisine, 0, -2) : ''; } $resto_info = "<h5><a href=\"" . baseUrl() . "/store/menu/merchant/" . $val['restaurant_slug'] . "\">" . $val['restaurant_name'] . "</a></h5>"; //$resto_cuisine="<span class=\"cuisine-list\">".$resto_cuisine."</span>"; $resto_cuisine = wordwrap($resto_cuisine, 50, "<br />\n"); $resto_info .= "<p class=\"uk-text-muted\">" . $val['street'] . " " . $val['city'] . " " . $val['post_code'] . "</p>"; if (array_key_exists($val['country_code'], (array) $country_list)) { $resto_info .= "<p class=\"uk-text-bold\">" . $country_list[$val['country_code']] . "</p>"; } $resto_info .= "<p class=\"uk-text-bold\">" . Yii::t('default', "Cuisine") . " - " . $resto_cuisine . "</p>"; $delivery_est = Yii::app()->functions->getOption("merchant_delivery_estimation", $val['merchant_id']); $distancesya = $miles_raw; $unit_distance = $merchant_distance_type; if (!empty($from_address)) { if ($ft == TRUE) { $resto_info .= "<p><span class=\"uk-text-bold\">" . Yii::t("default", "Distance") . ": </span> {$miles_raw} </p>"; if ($merchant_distance_type == "km") { $distance_type = Yii::t("default", "km"); } else { $distance_type = Yii::t("default", "miles"); } } else { if ($merchant_distance_type == "km") { $distance_type = Yii::t("default", "km"); $resto_info .= "<p><span class=\"uk-text-bold\">" . Yii::t("default", "Distance") . ": </span> {$kms} " . Yii::t("default", "km") . "</p>"; $distancesya = $kms; } else { $resto_info .= "<p><span class=\"uk-text-bold\">" . Yii::t("default", "Distance") . ": </span> {$miles_raw} " . Yii::t("default", "miles") . "</p>"; $distance_type = Yii::t("default", "miles"); } } } $resto_info .= "<p><span class=\"uk-text-bold\">" . Yii::t("default", "Delivery Est") . ": </span> " . $delivery_est . "</p>"; if (is_numeric($mt_delivery_miles)) { $resto_info .= "<p><span class=\"uk-text-bold\">" . Yii::t("default", "Delivery Distance") . ": </span> " . $mt_delivery_miles . " " . $distance_type . "</p>"; } $shipping_enabled = Yii::app()->functions->getOption("shipping_enabled", $val['merchant_id']); //delivery rates table $delivery_fee = $val['delivery_charges']; if ($shipping_enabled == 2) { $FunctionsK = new FunctionsK(); //$distancesya=round($distancesya); //dump($distancesya); $delivery_fee = $FunctionsK->getDeliveryChargesByDistance($val['merchant_id'], $distancesya, $unit_distance, $delivery_fee); if ($delivery_fee >= 0.01) { if (isset($_GET['filter_promo'])) { if (preg_match("/free-delivery/i", $_GET['filter_promo'])) { $minus_has_delivery_rates++; continue; } } } } if (is_numeric($delivery_fee) && $delivery_fee >= 1) { $resto_info .= "<p><span class=\"uk-text-bold\">" . Yii::t("default", "Delivery Fee") . ":</span> " . displayPrice(getCurrencyCode(), prettyFormat($delivery_fee)) . "</p>"; } else { $resto_info .= "<p><span class=\"uk-text-bold\">" . Yii::t("default", "Delivery Fee") . ":</span> " . "<span class=\"uk-text-success\">" . Yii::t("default", "Free Delivery") . "</span>" . "</p>"; } $image = ''; $merchant_photo = Yii::app()->functions->getOption("merchant_photo", $val['merchant_id']); if (!empty($merchant_photo)) { $image .= "<a href=\"" . baseUrl() . "/store/menu/merchant/" . $val['restaurant_slug'] . "\">"; $image .= "<img class=\"uk-thumbnail uk-thumbnail-mini\" src=\"" . baseUrl() . "/upload/" . $merchant_photo . "\" alt=\"\" title=\"\">"; $image .= "</a>"; } if (empty($image)) { $image .= "<a href=\"" . baseUrl() . "/store/menu/merchant/" . $val['restaurant_slug'] . "\">"; $image .= "<img class=\"uk-thumbnail uk-thumbnail-mini\" src=\"" . baseUrl() . "/assets/images/thumbnail-medium.png\" alt=\"\" title=\"\">"; $image .= "</a>"; } $ratings = Yii::app()->functions->getRatings($val['merchant_id']); $rating_meanings = ''; if ($ratings['ratings'] >= 1) { $rating_meaning = Yii::app()->functions->getRatingsMeaning($ratings['ratings']); $rating_meanings = ucwords($rating_meaning['meaning']); } $rating = "<div class=\"rate-wrap\">\r\n\t \t\t\t\t<h6 class=\"rounded2\" data-uk-tooltip=\"{pos:'bottom-left'}\" title=\"{$rating_meanings}\" >" . number_format($ratings['ratings'], 1) . "</h6>\r\n\t \t\t\t\t<span>" . $ratings['votes'] . " " . Yii::t("default", "Votes") . "</span>\r\n\t \t\t\t\t</div>"; $stores_open_day = Yii::app()->functions->getOption("stores_open_day", $val['merchant_id']); $stores_open_starts = Yii::app()->functions->getOption("stores_open_starts", $val['merchant_id']); $stores_open_ends = Yii::app()->functions->getOption("stores_open_ends", $val['merchant_id']); $stores_open_custom_text = Yii::app()->functions->getOption("stores_open_custom_text", $val['merchant_id']); $stores_open_day = !empty($stores_open_day) ? (array) json_decode($stores_open_day) : false; $stores_open_starts = !empty($stores_open_starts) ? (array) json_decode($stores_open_starts) : false; $stores_open_ends = !empty($stores_open_ends) ? (array) json_decode($stores_open_ends) : false; $stores_open_custom_text = !empty($stores_open_custom_text) ? (array) json_decode($stores_open_custom_text) : false; $tip = ''; $open_starts = ''; $open_ends = ''; $open_text = ''; $tip .= "<ul class=\"hr_op rounded2\"><i class=\"fa fa-caret-up\"></i>"; if (is_array($stores_open_day) && count($stores_open_day) >= 1) { foreach ($stores_open_day as $val_open) { if (array_key_exists($val_open, (array) $stores_open_starts)) { $open_starts = timeFormat($stores_open_starts[$val_open], true); } if (array_key_exists($val_open, (array) $stores_open_ends)) { $open_ends = timeFormat($stores_open_ends[$val_open], true); } if (array_key_exists($val_open, (array) $stores_open_custom_text)) { $open_text = $stores_open_custom_text[$val_open]; } $tip .= '<li><span>' . ucwords(Yii::t("default", $val_open)) . '</span><value>' . $open_starts . " - " . $open_ends . " " . ucfirst($open_text) . '</value></li>'; $open_starts = ''; $open_ends = ''; $open_text = ''; } } else { $tip .= '<li>' . Yii::t("default", "Not available.") . '</li>'; } $tip .= "<div class=\"clear\"></div>"; $tip .= "</ul>"; $tips = "<a class=\"opening-hours-wrap\" href=\"javascript:;\">" . Yii::t("default", "Hours of Operation") . "{$tip}</a>"; $resto_info .= $tips; $resto_info .= "<div class=\"spacer\"></div>"; $resto_info .= "<div>\r\n\t\t\t\t\t\t<a class=\"uk-button uk-button-success uk-width-1-2\" href=\"" . baseUrl() . "/store/menu/merchant/" . $val['restaurant_slug'] . "\">"; $resto_info .= Yii::t("default", "Order Now"); $resto_info .= "</a></div>"; $resto_info .= "<div class=\"spacer\"></div>"; $table_book = Yii::app()->functions->getOption("merchant_table_booking", $val['merchant_id']); if ($table_book == "") { $resto_info .= "<div>\r\n\t\t\t\t\t\t<a class=\"uk-button uk-button-success uk-width-1-2\" href=\"" . baseUrl() . "/store/menu/merchant/" . $val['restaurant_slug'] . "/?tab=booking" . "\">"; $resto_info .= Yii::t("default", "Book a Table"); $resto_info .= "</a></div>"; } $is_sponsored = ''; if ($val['is_sponsored'] == 2) { $is_sponsored = "<br/><div class=\"uk-badge uk-badge-warning\">" . Yii::t("default", "sponsored") . "</div>"; } $is_merchant_open = Yii::app()->functions->isMerchantOpen($val['merchant_id']); $merchant_preorder = Yii::app()->functions->getOption("merchant_preorder", $val['merchant_id']); $now = date('Y-m-d'); $is_holiday = false; if ($m_holiday = Yii::app()->functions->getMerchantHoliday($val['merchant_id'])) { if (in_array($now, (array) $m_holiday)) { $is_merchant_open = false; } } $tag_open = ''; if ($is_merchant_open == TRUE) { $tag_open = '<div class="uk-badge uk-badge-success">' . t("Open") . '</div>'; } else { if ($merchant_preorder) { $tag_open = '<div class="uk-badge uk-badge-warning">' . t("Pre-Order") . '</div>'; } else { $tag_open = '<div class="uk-badge uk-badge-danger">' . t("Closed") . '</div>'; } } $is_sponsored .= $tag_open; $offers = Widgets::offers($val['merchant_id'], 2); $is_sponsored .= $offers; $merchant_latitude = Yii::app()->functions->getOption("merchant_latitude", $val['merchant_id']); $merchant_longtitude = Yii::app()->functions->getOption("merchant_longtitude", $val['merchant_id']); $merchant_latitude = !empty($merchant_latitude) ? $merchant_latitude : '0'; $merchant_longtitude = !empty($merchant_longtitude) ? $merchant_longtitude : '0'; $feed_data[] = array($image, $resto_info, $rating, !empty($val['minimum_order']) ? displayPrice(getCurrencyCode(), prettyFormat($val['minimum_order'])) . "<br/>" . $is_sponsored : "{$is_sponsored}", $miles_raw, $merchant_latitude, $merchant_longtitude, addslashes($val['restaurant_name']), $merchant_address, $val['restaurant_slug'], $image, $new_distance_raw); } $this->data['sort_filter'] = isset($this->data['sort_filter']) ? $this->data['sort_filter'] : ''; //dump($feed_data); if ($this->data['sort_filter'] == "distance") { Yii::app()->functions->arraySortByColumn($feed_data, 11); $feed_datas['aaData'] = $feed_data; } else { /** sort by distance */ if (Yii::app()->functions->getOptionAdmin('search_result_bydistance') == 2) { Yii::app()->functions->arraySortByColumn($feed_data, 11); $feed_datas['aaData'] = $feed_data; } else { $feed_datas['aaData'] = $feed_data; } } //dump("minus_has_delivery_rates->".$minus_has_delivery_rates); if ($minus_has_delivery_rates >= 1) { $feed_datas['iTotalRecords'] = $feed_datas['iTotalRecords'] - $minus_has_delivery_rates; $feed_datas['iTotalDisplayRecords'] = $feed_datas['iTotalDisplayRecords'] - $minus_has_delivery_rates; if ($feed_datas['iTotalRecords'] <= 0) { $this->otableNodata(); } } $this->otableOutput($feed_datas); } } $this->otableNodata(); }
public function __construct($SphinxClient, $Settings) { parent::__construct($SphinxClient, $Settings); }