Beispiel #1
0
 function toArray($partner = array())
 {
     $smartConfig = smartpartner_getModuleConfig();
     $partner['id'] = $this->id();
     $partner['hits'] = $this->hits();
     $partner['hits_page'] = $this->hits_page();
     $partner['url'] = $this->url();
     $partner['urllink'] = $this->getUrlLink('partner');
     $partner['image'] = $this->getImageUrl();
     $partner['title'] = $this->title();
     $partner['clean_title'] = $partner['title'];
     $partner['summary'] = $this->summary();
     if ($this->description() != '') {
         $partner['description'] = $this->description();
     } else {
         $partner['description'] = $this->summary();
     }
     $partner['contact_name'] = $this->contact_name();
     $partner['contact_email'] = $this->contact_email('x');
     $partner['contact_phone'] = $this->contact_phone();
     $partner['adress'] = $this->adress();
     $image_info = smartpartner_imageResize($this->getImagePath(), $smartConfig['img_max_width'], $smartConfig['img_max_height']);
     $partner['img_attr'] = $image_info[3];
     $partner['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 SmartpartnerKeyhighlighter($keywords, true, 'smartpartner_highlighter');
         $partner['title'] = $h->highlight($partner['title']);
         $partner['summary'] = $h->highlight($partner['summary']);
         $partner['description'] = $h->highlight($partner['description']);
         $partner['contact_name'] = $h->highlight($partner['contact_name']);
         $partner['contact_email'] = $h->highlight($partner['contact_email']);
         $partner['contact_phone'] = $h->highlight($partner['contact_phone']);
         $partner['adress'] = $h->highlight($partner['adress']);
     }
     return $partner;
 }
Beispiel #2
0
 function toArray($url_link_type = 'partner')
 {
     $smartConfig = smartpartner_getModuleConfig();
     $partner['id'] = $this->id();
     $partner['categoryid'] = $this->categoryid();
     $partner['hits'] = $this->hits();
     $partner['hits_page'] = $this->hits_page();
     $partner['url'] = $this->url();
     $partner['urllink'] = $this->getUrlLink($url_link_type);
     $partner['image'] = $this->getImageUrl();
     $partner['title'] = $this->title();
     $partner['datesub'] = $this->datesub();
     $partner['clean_title'] = $partner['title'];
     $partner['summary'] = $this->summary();
     $partner['contact_name'] = $this->contact_name();
     $partner['contact_email'] = $this->contact_email();
     $partner['contact_phone'] = $this->contact_phone();
     $partner['adress'] = $this->adress();
     $partner['email_priv'] = $this->email_priv();
     $partner['phone_priv'] = $this->phone_priv();
     $partner['adress_priv'] = $this->adress_priv();
     $image_info = smartpartner_imageResize($this->getImagePath(), $smartConfig['img_max_width'], $smartConfig['img_max_height']);
     $partner['img_attr'] = $image_info[3];
     $partner['readmore'] = $this->extentedInfo();
     if (time() - $this->datesub('e') < $smartConfig['updated_period'] * 24 * 3600) {
         $partner['update_status'] = 'new';
     } elseif (time() - $this->getVar('last_update') < $smartConfig['updated_period'] * 24 * 3600) {
         $partner['update_status'] = 'updated';
     } else {
         $partner['update_status'] = 'none';
     }
     //--------------
     global $smartpermissions_handler, $smartpartner_partner_handler, $xoopsUser;
     include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectpermission.php';
     if (!$smartpartner_partner_handler) {
         $smartpartner_partner_handler =& smartpartner_gethandler('partner');
     }
     $smartpermissions_handler = new SmartobjectPermissionHandler($smartpartner_partner_handler);
     $grantedGroups = $smartpermissions_handler->getGrantedGroups('full_view', $this->id());
     $partGrantedGroups = $smartpermissions_handler->getGrantedGroups('partial_view', $this->id());
     $userGroups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
     if (array_intersect($userGroups, $grantedGroups)) {
         $partner['display_type'] = 'full';
     } elseif (array_intersect($userGroups, $partGrantedGroups)) {
         $partner['display_type'] = 'part';
     } else {
         $partner['display_type'] = 'none';
     }
     if ($this->description() != '' && $partner['display_type'] == 'full') {
         $partner['description'] = $this->description();
     } else {
         //$partner['description'] = $this->summary();
     }
     $partner['showsummary'] = $this->getVar('showsummary');
     //--------------
     // Hightlighting searched words
     $highlight = true;
     if ($highlight && isset($_GET['keywords'])) {
         $myts =& MyTextSanitizer::getInstance();
         $keywords = $myts->htmlSpecialChars(trim(urldecode($_GET['keywords'])));
         $h = new SmartpartnerKeyhighlighter($keywords, true, 'smartpartner_highlighter');
         $partner['title'] = $h->highlight($partner['title']);
         $partner['summary'] = $h->highlight($partner['summary']);
         $partner['description'] = $h->highlight($partner['description']);
         $partner['contact_name'] = $h->highlight($partner['contact_name']);
         $partner['contact_email'] = $h->highlight($partner['contact_email']);
         $partner['contact_phone'] = $h->highlight($partner['contact_phone']);
         $partner['adress'] = $h->highlight($partner['adress']);
     }
     return $partner;
 }