示例#1
0
 public function displayList()
 {
     $id_lang = $this->context->language->id;
     $id_shop = $this->context->shop->id;
     MyFriends::displaySlide();
     $limit_per_page = intval($this->conf['list_limit_page']);
     $current_page = isset($_GET['p']) && is_numeric($_GET['p']) ? intval($_GET['p']) : 1;
     $start = ($current_page - 1) * $limit_per_page;
     $list = FriendsInfo::getFriends();
     $listFriends = array();
     if (isset($list) && is_array($list) && count($list)) {
         /** pagination * */
         //            $nb_pages = ceil($nb_articles / $limit_per_page);
         //            $next = $current_page > 1 ? true : false; //articles plus recents
         //            $back = $current_page >= 1 && ($current_page < $nb_pages) ? true : false; //articles precedents
         $i = 0;
         foreach ($list as $cat) {
             $media = FriendsImage::getImageByFriend($cat['id_friend']);
             $cat['media'] = $media;
             $listFriends[] = $cat;
         }
         //            echo '<pre>';
         //            print_r($listCategories);
         //            echo '</pre>';
         $this->context->smarty->assign(array('list_friends' => $listFriends, 'img_friend_dir' => _THEME_FRIEND_DIR_));
     }
     $this->setTemplate('list.tpl');
 }
     $this->addJqueryUi('ui.widget');
     $this->addJqueryPlugin('tagify');
 }
 public function renderForm()
 {
     $this->toolbar_btn['save-and-stay'] = array('href' => '#', 'desc' => $this->l('Save and stay'));
     $this->initToolbar();
     $this->fields_form = array('tinymce' => true, 'legend' => array('title' => $this->l('Friend Image/Video'), 'image' => '../img/admin/tab-categories.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Title:'), 'name' => 'title', 'required' => true, 'lang' => true, 'class' => 'copy2friendlyUrl', 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'text', 'label' => $this->l('Video ID:'), 'name' => 'youtube_id', 'class' => 'copy2friendlyUrl', 'hint' => $this->l('This is the id of youtube video')), array('type' => 'file', 'label' => $this->l('Image:'), 'name' => 'image', 'display_image' => true)), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'));
     $this->fields_form['input'][] = array('type' => 'text', 'label' => $this->l('Position :'), 'size' => 3, 'name' => 'position');
     $friends = FriendsInfo::listFriends();
     $this->fields_form['input'][] = array('type' => 'select', 'label' => $this->l('Friend'), 'desc' => $this->l('Choose a friend'), 'name' => 'id_friend', 'required' => true, 'options' => array('query' => $friends, 'id' => 'id_option', 'name' => 'name'));
     $this->fields_form['input'][] = array('type' => 'radio', 'label' => $this->l('Status :'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))));
     if (!($friends = $this->loadObject(true))) {
         return;
     }
     //        $image = ImageManager::thumbnail(_PS_MYFRIENDS_IMG_DIR_.'/'.$friends->id.'.jpg', $this->table.'_'.(int)$friends->id.'.'.$this->imageType, 350, $this->imageType, true);
     //		$this->fields_value = array(
     //			'image' => $image ? $image : false,
     //			'size' => $image ? filesize(_PS_MYFRIENDS_IMG_DIR_.'/'.$friends->id.'.jpg') / 1000 : false