Example #1
0
 protected function getInput()
 {
     $data = null;
     foreach ((array) $this->form as $key => $val) {
         if ($val instanceof JRegistry) {
             $data =& $val;
             break;
         }
     }
     $data = $data->toArray();
     $selectedOptions = '';
     if (isset($data['params']['section_id'])) {
         $selectedOptions = $data['params']['section_id'];
     }
     return Categories::selectList($this->id, $this->name, $selectedOptions);
     $htmlCode = '<select id="' . $this->id . '" name="' . $this->name . '[]" class="inputbox" multiple="multiple">';
     $defaultOption = array(array('id' => '', 'title' => 'none'));
     $categories = array_merge($defaultOption, Categories::getCategories());
     $selected = $this->params;
     $data = null;
     foreach ((array) $this->form as $key => $val) {
         if ($val instanceof JRegistry) {
             $data =& $val;
             break;
         }
     }
     $data = $data->toArray();
     $selectedOptions = $data['params']['section_id'];
     foreach ($categories as $category) {
         $selected = '';
         if (isset($selectedOptions)) {
             $selected = in_array($category['id'], $selectedOptions) ? ' selected="selected"' : '';
         }
         $options .= '<option value="' . $category['id'] . '"' . $selected . '>' . $category['title'] . '</option>';
     }
     $htmlCode .= $options;
     $htmlCode .= '</select>';
     return $htmlCode;
 }
    $item_count = 0;
    if (\Session::has('Giftertipster\\Repository\\AmzProduct\\AmzProductRepository.cart')) {
        $cart = \Session::get('Giftertipster\\Repository\\AmzProduct\\AmzProductRepository.cart');
        foreach ($cart['items'] as $item) {
            $item_count += $item['quantity'];
        }
    }
    if ($item_count > 0) {
        return '<span class="badge">' . $item_count . '</span>';
    }
    return '';
});
//doesnt currently support sub interests
HTML::macro('decodedGiftCategory', function ($category_config_key, $id) {
    $category_config_key = str_replace('_ids', '_categories', $category_config_key);
    $categories = Categories::getCategories();
    foreach ($categories[$category_config_key] as $category) {
        if ($category['id'] == $id) {
            return $category['label'];
        }
    }
    throw new \RuntimeException('Unable to decode gift category. category config key: ' . $category_config_key . ' id: ' . $id);
});
HTML::macro('truncate', function ($string, $max_length) {
    return str_limit($string, $limit = $max_length, $end = '...');
});
HTML::macro('listedItemPrice', function ($item) {
    if ($item['min_price_amount'] != $item['max_price_amount']) {
        return $item['min_price_formatted'] . ' - ' . $item['max_price_formatted'];
    }
    return $item['min_price_formatted'];
Example #3
0
<?php

/**
 * get categorise
 */
include '../App.php';
include './Categories.php';
$url = $_POST['url'];
$excludes = $_POST['excludes'];
$categorise = new Categories();
if ($_GET['type'] === 'dev') {
    $json = $categorise->getCategories('http://list.jd.com/list.html?cat=670%2C671%2C672&ev=&page=1');
    dump($json);
    exit;
}
$json = $categorise->getCategories($url, explode(',', $excludes));
// dump($json);
echo json_encode($json);
Example #4
0
 /**
  * List all packages, organized by category (unsorted)
  *
  * @return array
  */
 function listPackagesByCategory()
 {
     $categories = new Categories($this->channel);
     $ret = array();
     foreach ($categories->getCategories() as $cat) {
         $ret[$cat] = $categories->packagesInCategory($cat);
     }
     return $ret;
 }
Example #5
0
?>
', function (result) {
        var objForm = $('#articles-form');
        if (result && result.length) {
            objForm.fileupload('option', 'done').call(objForm, null, {result: result});
        }
    });
</script>
<?php 
$this->widget('xupload.XUpload', array('url' => Yii::app()->createUrl("/administrator/articles/upload"), 'model' => $files, 'htmlOptions' => array('id' => 'articles-form'), 'attribute' => 'file', 'multiple' => true));
$form = $this->beginWidget('booster.widgets.TbActiveForm', array('id' => 'articles-form', 'type' => 'vertical', 'enableAjaxValidation' => false, 'enableClientValidation' => true, 'htmlOptions' => array('enctype' => 'multipart/form-data')));
?>


<?php 
echo $form->dropDownListGroup($model, 'category_id', array('wrapperHtmlOptions' => array(), 'widgetOptions' => array('data' => Categories::getCategories(), 'htmlOptions' => array())));
?>
<div class="row">
    <div class="col-lg-4">
        <?php 
echo $form->textFieldGroup($model, 'name_uk', array('widgetOptions' => array('htmlOptions' => array('class' => 'span5', 'maxlength' => 50))));
?>
    </div>
    <div class="col-lg-4">
        <?php 
echo $form->textFieldGroup($model, 'name_en', array('widgetOptions' => array('htmlOptions' => array('class' => 'span5', 'maxlength' => 50))));
?>
    </div>
    <div class="col-lg-4">
        <?php 
echo $form->textFieldGroup($model, 'name_ru', array('widgetOptions' => array('htmlOptions' => array('class' => 'span5', 'maxlength' => 50))));