Exemple #1
0
 function toArray($client = array())
 {
     $smartConfig = smartclient_getModuleConfig();
     $client['id'] = $this->id();
     $client['hits'] = $this->hits();
     $client['hits_page'] = $this->hits_page();
     $client['url'] = $this->url();
     $client['urllink'] = $this->getUrlLink('client');
     $client['image'] = $this->getImageUrl();
     $client['title'] = $this->title();
     $client['clean_title'] = $client['title'];
     $client['summary'] = $this->summary();
     if ($this->description() != '') {
         $client['description'] = $this->description();
     } else {
         $client['description'] = $this->summary();
     }
     $client['contact_name'] = $this->contact_name();
     $client['contact_email'] = $this->contact_email('x');
     $client['contact_phone'] = $this->contact_phone();
     $client['adress'] = $this->adress();
     $image_info = smartclient_imageResize($this->getImagePath(), $smartConfig['img_max_width'], $smartConfig['img_max_height']);
     $client['img_attr'] = $image_info[3];
     $client['readmore'] = $this->extentedInfo();
     // Hightlighting searched words
     $highlight = true;
     if ($highlight && isset($_GET['keywords'])) {
         $myts =& MyTextSanitizer::getInstance();
         $keywords = $myts->htmlSpecialChars(trim(urldecode($_GET['keywords'])));
         $h = new SmartclientKeyhighlighter($keywords, true, 'smartclient_highlighter');
         $client['title'] = $h->highlight($client['title']);
         $client['summary'] = $h->highlight($client['summary']);
         $client['description'] = $h->highlight($client['description']);
         $client['contact_name'] = $h->highlight($client['contact_name']);
         $client['contact_email'] = $h->highlight($client['contact_email']);
         $client['contact_phone'] = $h->highlight($client['contact_phone']);
         $client['adress'] = $h->highlight($client['adress']);
     }
     return $client;
 }
/**
 * $Id: clients_list.php,v 1.3 2005/04/23 13:20:10 malanciault Exp $
 * Module: SmartClient
 * Author: The SmartFactory <www.smartfactory.ca>
 * Licence: GNU
 */
function b_clients_list_show($options)
{
    // This must contain the name of the folder in which reside SmartClient
    if (!defined("SMARTCLIENT_DIRNAME")) {
        define("SMARTCLIENT_DIRNAME", 'smartclient');
    }
    include_once XOOPS_ROOT_PATH . "/modules/" . SMARTCLIENT_DIRNAME . "/include/common.php";
    // Creating the client handler object
    $client_handler =& smartclient_gethandler('client');
    if ($options[2]) {
        // Randomize
        $clientsObj =& $client_handler->getClients(0, 0, _SCLIENT_STATUS_ACTIVE);
        if (count($clientsObj) > 1) {
            $key_arr = array_keys($clientsObj);
            $key_rand = array_rand($key_arr, count($key_arr));
            for ($i = 0; $i < count($clientsObj) && $i < $options[3]; $i++) {
                $newObjs[$i] = $clientsObj[$key_rand[$i]];
            }
            $clientsObj = $newObjs;
        }
    } else {
        $clientsObj =& $client_handler->getClients($options[3], 0, _SCLIENT_STATUS_ACTIVE, $options[5], $options[6]);
        if (count($clientsObj) > 1 && $options[2] == 1) {
            $key_arr = array_keys($clientsObj);
            $key_rand = array_rand($key_arr, count($key_arr));
            for ($i = 0; $i < count($clientsObj); $i++) {
                $newObjs[$i] = $clientsObj[$key_rand[$i]];
            }
            $clientsObj = $newObjs;
        }
    }
    $block = array();
    if ($clientsObj) {
        for ($i = 0; $i < count($clientsObj); $i++) {
            $client['id'] = $clientsObj[$i]->id();
            $client['urllink'] = $clientsObj[$i]->getUrlLink('block');
            if ($clientsObj[$i]->image() && ($options[4] == 1 || $options[4] == 3)) {
                $client['image'] = $clientsObj[$i]->getImageUrl();
            }
            if ($clientsObj[$i]->image() && ($options[4] == 2 || $options[4] == 3)) {
                $client['title'] = $clientsObj[$i]->title();
            } else {
                $client['title'] = '';
            }
            $smartConfig =& smartclient_getModuleConfig();
            $image_info = smartclient_imageResize($clientsObj[$i]->getImagePath(), $smartConfig['img_max_width'], $smartConfig['img_max_height']);
            $client['img_attr'] = $image_info[3];
            $client['extendedInfo'] = $clientsObj[$i]->extentedInfo();
            $block['clients'][] = $client;
        }
        if ($options[0] == 1) {
            $block['insertBr'] = true;
        }
        if ($options[1] == 1) {
            $block['fadeImage'] = 'style="filter:alpha(opacity=20);" onmouseover="nereidFade(this,100,30,5)" onmouseout="nereidFade(this,50,30,5)"';
        }
        $block['see_all'] = $options[7];
        $block['lang_see_all'] = _MB_SCLIENT_LANG_SEE_ALL;
        $block['smartclient_url'] = SMARTCLIENT_URL;
    }
    return $block;
}