Esempio n. 1
0
function smartpartner_search($queryarray, $andor, $limit, $offset, $userid)
{
    // This must contain the name of the folder in which reside SmartPartner
    if (!defined("SMARTPARTNER_DIRNAME")) {
        define("SMARTPARTNER_DIRNAME", 'smartpartner');
    }
    include_once XOOPS_ROOT_PATH . '/modules/' . SMARTPARTNER_DIRNAME . '/include/common.php';
    $ret = array();
    if (!isset($smartpartner_partner_handler)) {
        $smartpartner_partner_handler =& smartpartner_gethandler('partner');
    }
    // Searching the partners
    $partners_result = $smartpartner_partner_handler->getObjectsForSearch($queryarray, $andor, $limit, $offset, $userid);
    if ($queryarray == '') {
        $keywords = '';
        $hightlight_key = '';
    } else {
        $keywords = implode('+', $queryarray);
        $hightlight_key = "&keywords=" . $keywords;
    }
    foreach ($partners_result as $result) {
        $item['image'] = "images/links/partner.gif";
        $item['link'] = "partner.php?id=" . $result['id'] . $hightlight_key;
        $item['title'] = "" . $result['title'];
        $item['time'] = "";
        $item['uid'] = "";
        $ret[] = $item;
        unset($item);
    }
    return $ret;
}
Esempio n. 2
0
function b_categories_list_show($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/smartpartner/include/common.php";
    $smartpartner_category_handler =& smartpartner_gethandler('category');
    $criteria = new CriteriaCompo();
    $criteria->setSort(isset($options[0]) ? $options[0] : 'name');
    $criteria->setOrder(isset($options[1]) ? $options[1] : 'ASC');
    $catsObj =& $smartpartner_category_handler->getobjects($criteria, true);
    $catArray = get_content(0, $catsObj, $options[2]);
    $block = array();
    $block['categories'] = $catArray;
    $block['displaysubs'] = $options[2];
    if (isset($_GET['view_category_id'])) {
        $current_id = $_GET['view_category_id'];
        $block['current'] = $catsObj[$current_id]->getVar('parentid') == 0 ? $current_id : $catsObj[$current_id]->getVar('parentid');
    } elseif (isset($_GET['id'])) {
        $smartpartner_partner_handler =& smartpartner_gethandler('partner');
        $partnerObj = $smartpartner_partner_handler->get($_GET['id']);
        if (is_object($partnerObj)) {
            $parent = $partnerObj->getVar('categoryid');
            $block['current'] = $catsObj[$parent]->getVar('parentid') == 0 ? $parent : $catsObj[$parent]->getVar('parentid');
        }
    }
    return $block;
}
Esempio n. 3
0
function b_recent_partners_show($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/smartpartner/include/common.php";
    // Creating the partner handler object
    $smartpartner_partner_handler =& smartpartner_gethandler('partner');
    $smartpartner_category_handler =& smartpartner_gethandler('category');
    // Randomize
    $partnersObj =& $smartpartner_partner_handler->getPartners($options[2], 0, _SPARTNER_STATUS_ACTIVE, 'datesub', 'DESC');
    include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectpermission.php';
    $smartpermissions_handler = new SmartobjectPermissionHandler($smartpartner_partner_handler);
    $grantedItems = $smartpermissions_handler->getGrantedItems('full_view');
    if ($partnersObj) {
        $block = array();
        foreach ($partnersObj as $partnerObj) {
            if (in_array($partnerObj->id(), $grantedItems)) {
                $block['partners'][] = $partnerObj->toArray();
            }
        }
    }
    if (!empty($block['partners'])) {
        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[6];
        $block['lang_see_all'] = _MB_SPARTNER_LANG_SEE_ALL;
        $block['smartpartner_url'] = SMARTPARTNER_URL;
    }
    return $block;
}
Esempio n. 4
0
 function partnerid()
 {
     global $smartpartner_partner_handler;
     if (!$smartpartner_partner_handler) {
         $smartpartner_partner_handler =& smartpartner_gethandler('partner');
     }
     $ret = $this->getVar('partnerid', 'e');
     $partnerObj = $smartpartner_partner_handler->get($ret);
     return $partnerObj->getVar('title');
 }
Esempio n. 5
0
function b_scrolling_partner_show($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/smartpartner/include/common.php";
    // Creating the partner handler object
    $smartpartner_partner_handler =& smartpartner_gethandler('partner');
    //$smartpartner_category_handler =& smartpartner_gethandler('category');
    // Randomize
    $partnersObj =& $smartpartner_partner_handler->getPartners(0, 0, _SPARTNER_STATUS_ACTIVE);
    if (count($partnersObj) > 1) {
        $key_arr = array_keys($partnersObj);
        $key_rand = array_rand($key_arr, count($key_arr));
        for ($i = 0; $i < count($partnersObj) && ($options[0] == 0 || $i < $options[0]); $i++) {
            $newObjs[$i] = $partnersObj[$key_rand[$i]];
        }
        $partnersObj = $newObjs;
    }
    /*	$cat_id = array();
                foreach($partnersObj as $partnerObj){
                    $p_cats = $partnerObj->categoryid();
                    $p_cat_rand = array_rand($p_cats);
    
                    if(!in_array($p_cats[$p_cat_rand],$cat_id)){
                        $cat_id[] = $p_cats[$p_cat_rand];
                    }
                }
        */
    $block = array();
    if ($partnersObj) {
        for ($i = 0; $i < count($partnersObj); $i++) {
            if ($partnersObj[$i]->image() != "" && $partnersObj[$i]->image() != "blank.png") {
                //$partner['id'] = $partnersObj[$i]->id();
                $partner['urllink'] = $partnersObj[$i]->getUrlLink('block');
                $partner['image'] = $partnersObj[$i]->getImageUrl();
                $partner['title'] = $partnersObj[$i]->title();
                $smartConfig =& smartpartner_getModuleConfig();
                $image_info = smartpartner_imageResize($partnersObj[$i]->getImagePath(), $smartConfig['img_max_width'], $smartConfig['img_max_height']);
                $block['partners'][] = $partner;
            }
        }
    }
    $block['width'] = $options[1];
    $block['height'] = $options[2];
    $block['speed'] = $options[3];
    $block['space'] = $options[4];
    $block['background'] = isset($options[5]) && $options[5] != '' ? $options[5] : 'FFFFFF';
    return $block;
}
function b_marquee_smartpartner($limit, $dateformat, $itemssize)
{
    $block = array();
    if (!defined("SMARTPARTNER_DIRNAME")) {
        define("SMARTPARTNER_DIRNAME", 'smartpartner');
    }
    include_once XOOPS_ROOT_PATH . "/modules/" . SMARTPARTNER_DIRNAME . "/include/common.php";
    // Creating the partner handler object
    $smartpartner_partner_handler =& smartpartner_gethandler('partner');
    $smartpartner_category_handler =& smartpartner_gethandler('category');
    // Randomize
    $partnersObj =& $smartpartner_partner_handler->getPartners(0, 0, _SPARTNER_STATUS_ACTIVE);
    if (count($partnersObj) > 1) {
        $key_arr = array_keys($partnersObj);
        $key_rand = array_rand($key_arr, count($key_arr));
        for ($i = 0; $i < count($partnersObj) && $i < $limit; $i++) {
            $newObjs[$i] = $partnersObj[$key_rand[$i]];
        }
        $partnersObj = $newObjs;
    }
    $cat_id = array();
    foreach ($partnersObj as $partnerObj) {
        if (!in_array($partnerObj->categoryid(), $cat_id)) {
            $cat_id[] = $partnerObj->categoryid();
        }
    }
    if ($partnersObj) {
        for ($j = 0; $j < count($cat_id); $j++) {
            $categoryObj = $smartpartner_category_handler->get($cat_id[$j]);
            for ($i = 0; $i < count($partnersObj); $i++) {
                if ($partnersObj[$i]->categoryid() == $cat_id[$j]) {
                    $smartConfig =& smartpartner_getModuleConfig();
                    if ($itemssize > 0) {
                        $title = xoops_substr($partnersObj[$i]->title(), 0, $itemssize + 3);
                    } else {
                        $title = $partnersObj[$i]->title();
                    }
                    $block[] = array('date' => '', 'category' => '', 'author' => '', 'title' => $title, 'link' => "<a href='" . XOOPS_URL . '/modules/smartpartner/partner.php?id=' . $partnersObj[$i]->id() . "'>" . $title . '</a>');
                }
            }
        }
    }
    return $block;
}
Esempio n. 7
0
/**
 * $Id: random_offer.php,v 1.1 2007/09/18 14:00:53 marcan Exp $
 * Module: SmartPartner
 * Author: The SmartFactory <www.smartfactory.ca>
 * Licence: GNU
 */
function b_random_offer_show($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/smartpartner/include/common.php";
    // Creating the partner handler object
    $smartpartner_offer_handler =& smartpartner_gethandler('offer');
    $smartpartner_partner_handler =& smartpartner_gethandler('partner');
    include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectpermission.php';
    $smartpermissions_handler = new SmartobjectPermissionHandler($smartpartner_partner_handler);
    //var_dump($smartpermissions_handler->handler);exit;
    $grantedItems = $smartpermissions_handler->getGrantedItems('full_view');
    if (!empty($grantedItems)) {
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('partnerid', '(' . implode(', ', $grantedItems) . ')', 'IN'));
        $criteria->add(new Criteria('date_pub', time(), '<'));
        $criteria->add(new Criteria('date_end', time(), '>'));
        $criteria->add(new Criteria('status', _SPARTNER_STATUS_ONLINE));
        // Randomize
        $offersObj =& $smartpartner_offer_handler->getObjects($criteria);
        if (count($offersObj) > 0) {
            $key_arr = array_keys($offersObj);
            $key_rand = array_rand($key_arr, 1);
            $offerObj = $offersObj[$key_rand];
        }
        $block = array();
        if (isset($offerObj) && is_object($offerObj)) {
            $block['offers'][] = $offerObj->toArray('e');
            $smartConfig =& smartpartner_getModuleConfig();
            //$image_info = smartpartner_imageResize($partnerObj->getImagePath(), $smartConfig['img_max_width'], $smartConfig['img_max_height']);
            if ($options[0] == 1) {
                $block['fadeImage'] = 'style="filter:alpha(opacity=20);" onmouseover="nereidFade(this,100,30,5)" onmouseout="nereidFade(this,50,30,5)"';
            }
            $block['see_all'] = $options[2];
            $block['lang_see_all'] = _MB_SPARTNER_LANG_SEE_ALL_OFFERS;
            $block['smartpartner_url'] = SMARTPARTNER_URL;
        }
    }
    return $block;
}
Esempio n. 8
0
/**
 * $Id: moving_partner.php,v 1.1 2007/09/18 14:00:53 marcan Exp $
 * Module: SmartPartner
 * Author: The SmartFactory <www.smartfactory.ca>
 * Licence: GNU
 */
function b_random_partner_show($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/smartpartner/include/common.php";
    // Creating the partner handler object
    $partner_handler =& smartpartner_gethandler('partner');
    // Randomize
    $partnersObj =& $partner_handler->getPartners(0, 0, _SPARTNER_STATUS_ACTIVE);
    if (count($partnersObj) > 0) {
        $key_arr = array_keys($partnersObj);
        $key_rand = array_rand($key_arr, 1);
        $partnerObj = $partnersObj[$key_rand];
    }
    $block = array();
    if ($partnerObj) {
        $partner['id'] = $partnerObj->id();
        $partner['urllink'] = $partnerObj->getUrlLink('block');
        if ($partnerObj->image() && ($options[1] == 1 || $options[1] == 3)) {
            $partner['image'] = $partnerObj->getImageUrl();
        }
        if ($partnerObj->image() && ($options[1] == 2 || $options[1] == 3)) {
            $partner['title'] = $partnerObj->title();
        } else {
            $partner['title'] = '';
        }
        $smartConfig =& smartpartner_getModuleConfig();
        $image_info = smartpartner_imageResize($partnerObj->getImagePath(), $smartConfig['img_max_width'], $smartConfig['img_max_height']);
        $partner['img_attr'] = $image_info[3];
        $partner['extendedInfo'] = $partnerObj->extentedInfo();
        if ($options[0] == 1) {
            $block['fadeImage'] = 'style="filter:alpha(opacity=20);" onmouseover="nereidFade(this,100,30,5)" onmouseout="nereidFade(this,50,30,5)"';
        }
        $block['see_all'] = $options[2];
        $block['lang_see_all'] = _MB_SPARTNER_LANG_SEE_ALL;
        $block['smartpartner_url'] = SMARTPARTNER_URL;
    }
    return $block;
}
Esempio n. 9
0
function editpartner($showmenu = false, $id = 0)
{
    global $xoopsDB, $smartpartner_partner_handler, $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule;
    if (!isset($smartpartner_partner_handler)) {
        $smartpartner_partner_handler =& smartpartner_gethandler('partner');
    }
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    // If there is a parameter, and the id exists, retrieve data: we're editing a partner
    if ($id != 0) {
        // Creating the partner object
        $partnerObj = new SmartpartnerPartner($id);
        if ($partnerObj->notLoaded()) {
            redirect_header("partner.php", 1, _AM_SPARTNER_NOPARTNERSELECTED);
            exit;
        }
        switch ($partnerObj->status()) {
            case _SPARTNER_STATUS_SUBMITTED:
                $breadcrumb_action1 = _AM_SPARTNER_SUBMITTED_PARTNERS;
                $breadcrumb_action2 = _AM_SPARTNER_APPROVING;
                $page_title = _AM_SPARTNER_SUBMITTED_TITLE;
                $page_info = _AM_SPARTNER_SUBMITTED_INFO;
                $button_caption = _AM_SPARTNER_APPROVE;
                $new_status = _SPARTNER_STATUS_ACTIVE;
                break;
            case _SPARTNER_STATUS_ACTIVE:
                $breadcrumb_action1 = _AM_SPARTNER_ACTIVE_PARTNERS;
                $breadcrumb_action2 = _AM_SPARTNER_EDITING;
                $page_title = _AM_SPARTNER_ACTIVE_EDITING;
                $page_info = _AM_SPARTNER_ACTIVE_EDITING_INFO;
                $button_caption = _AM_SPARTNER_MODIFY;
                $new_status = _SPARTNER_STATUS_ACTIVE;
                break;
            case _SPARTNER_STATUS_INACTIVE:
                $breadcrumb_action1 = _AM_SPARTNER_INACTIVE_PARTNERS;
                $breadcrumb_action2 = _AM_SPARTNER_EDITING;
                $page_title = _AM_SPARTNER_INACTIVE_EDITING;
                $page_info = _AM_SPARTNER_INACTIVE_EDITING_INFO;
                $button_caption = _AM_SPARTNER_MODIFY;
                $new_status = _SPARTNER_STATUS_INACTIVE;
                break;
            case _SPARTNER_STATUS_REJECTED:
                $breadcrumb_action1 = _AM_SPARTNER_REJECTED_PARTNERS;
                $breadcrumb_action2 = _AM_SPARTNER_EDITING;
                $page_title = _AM_SPARTNER_REJECTED_EDITING;
                $page_info = _AM_SPARTNER_REJECTED_EDITING_INFO;
                $button_caption = _AM_SPARTNER_MODIFY;
                $new_status = _SPARTNER_STATUS_REJECTED;
                break;
            case "default":
            default:
                break;
        }
        if ($showmenu) {
            smartpartner_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2);
        }
        echo "<br />\n";
        smartpartner_collapsableBar('editpartner', 'editpartmericon', $page_title, $page_info);
    } else {
        // there's no parameter, so we're adding a partner
        $partnerObj =& $smartpartner_partner_handler->create();
        $breadcrumb_action1 = _AM_SPARTNER_PARTNERS;
        $breadcrumb_action2 = _AM_SPARTNER_CREATE;
        $button_caption = _AM_SPARTNER_CREATE;
        $new_status = _SPARTNER_STATUS_ACTIVE;
        if ($showmenu) {
            smartpartner_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2);
        }
        smartpartner_collapsableBar('addpartner', 'addpartmericon', _AM_SPARTNER_PARTNER_CREATING, _AM_SPARTNER_PARTNER_CREATING_DSC);
    }
    // PARTNER FORM
    $sform = new XoopsThemeForm(_AM_SPARTNER_PARTNERS, "op", xoops_getenv('PHP_SELF'));
    $sform->setExtra('enctype="multipart/form-data"');
    // TITLE
    $title_text = new XoopsFormText(_AM_SPARTNER_TITLE, 'title', 50, 255, $partnerObj->title('e'));
    $sform->addElement($title_text, true);
    // Parent Category
    $mytree = new SmartTree($xoopsDB->prefix("smartpartner_categories"), "categoryid", "parentid");
    ob_start();
    $mytree->makeMySelBox("name", "weight", explode('|', $partnerObj->categoryid()), 0, 'categoryid', '', true);
    //makeMySelBox($title,$order="",$preset_id=0, $none=0, $sel_name="", $onchange="")
    $parent_cat_select = new XoopsFormLabel(_AM_SPARTNER_CATEGORY_BELONG, ob_get_contents());
    $parent_cat_select->setDescription(_AM_SPARTNER_BELONG_CATEGORY_DSC);
    $sform->addElement($parent_cat_select);
    ob_end_clean();
    // LOGO
    $logo_array =& XoopsLists::getImgListAsArray(smartpartner_getImageDir());
    $logo_select = new XoopsFormSelect('', 'image', $partnerObj->image());
    $logo_select->addOption('-1', '---------------');
    $logo_select->addOptionArray($logo_array);
    $logo_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/' . SMARTPARTNER_DIRNAME . '/images' . "\", \"\", \"" . XOOPS_URL . "\")'");
    $logo_tray = new XoopsFormElementTray(_AM_SPARTNER_LOGO, '&nbsp;');
    $logo_tray->addElement($logo_select);
    $logo_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartpartner_getImageDir('', false) . $partnerObj->image() . "' name='image3' id='image3' alt='' />"));
    $logo_tray->setDescription(_AM_SPARTNER_LOGO_DSC);
    $sform->addElement($logo_tray);
    // LOGO UPLOAD
    $max_size = 5000000;
    $file_box = new XoopsFormFile(_AM_SPARTNER_LOGO_UPLOAD, "logo_file", $max_size);
    $file_box->setExtra("size ='45'");
    $file_box->setDescription(sprintf(_AM_SPARTNER_LOGO_UPLOAD_DSC, $xoopsModuleConfig['img_max_width'], $xoopsModuleConfig['img_max_height']));
    $sform->addElement($file_box);
    // IMAGE_URL
    $image_url_text = new XoopsFormText(_CO_SPARTNER_IMAGE_URL, 'image_url', 50, 255, $partnerObj->image_url());
    $image_url_text->setDescription(_CO_SPARTNER_IMAGE_URL_DSC);
    $sform->addElement($image_url_text, false);
    // URL
    $url_text = new XoopsFormText(_AM_SPARTNER_URL, 'url', 50, 255, $partnerObj->url());
    $url_text->setDescription(_AM_SPARTNER_URL_DSC);
    $sform->addElement($url_text, false);
    // SUMMARY
    $summary_text = new XoopsFormTextArea(_AM_SPARTNER_SUMMARY, 'summary', $partnerObj->summary(0, 'e'), 7, 60);
    $summary_text->setDescription(_AM_SPARTNER_SUMMARY_DSC);
    $sform->addElement($summary_text, true);
    // SHOW summary on partner page
    $showsum_radio = new XoopsFormRadioYN(_AM_SPARTNER_SHOW_SUMMARY, 'showsummary', $partnerObj->getVar('showsummary'));
    $showsum_radio->setDescription(_AM_SPARTNER_SHOW_SUMMARY_DSC);
    $sform->addElement($showsum_radio);
    // DESCRIPTION
    $description_text = new XoopsFormDhtmlTextArea(_AM_SPARTNER_DESCRIPTION, 'description', $partnerObj->description(0, 'e'), 15, 60);
    $description_text->setDescription(_AM_SPARTNER_DESCRIPTION_DSC);
    $sform->addElement($description_text, false);
    // CONTACT_NAME
    $contact_name_text = new XoopsFormText(_CO_SPARTNER_CONTACT_NAME, 'contact_name', 50, 255, $partnerObj->contact_name('e'));
    $contact_name_text->setDescription(_CO_SPARTNER_CONTACT_NAME_DSC);
    $sform->addElement($contact_name_text, false);
    // CONTACT_EMAIL
    $contact_email_text = new XoopsFormText(_CO_SPARTNER_CONTACT_EMAIL, 'contact_email', 50, 255, $partnerObj->contact_email('e'));
    $contact_email_text->setDescription(_CO_SPARTNER_CONTACT_EMAIL_DSC);
    $sform->addElement($contact_email_text, false);
    // EMAIL_PRIV
    $email_priv_radio = new XoopsFormRadioYN(_CO_SPARTNER_CONTACT_EMAILPRIV, 'email_priv', $partnerObj->email_priv('e'));
    $email_priv_radio->setDescription(_CO_SPARTNER_CONTACT_EMAILPRIV_DSC);
    $sform->addElement($email_priv_radio);
    // CONTACT_PHONE
    $contact_phone_text = new XoopsFormText(_CO_SPARTNER_CONTACT_PHONE, 'contact_phone', 50, 255, $partnerObj->contact_phone('e'));
    $contact_phone_text->setDescription(_CO_SPARTNER_CONTACT_PHONE_DSC);
    $sform->addElement($contact_phone_text, false);
    // PHONE_PRIV
    $phone_priv_radio = new XoopsFormRadioYN(_CO_SPARTNER_CONTACT_PHONEPRIV, 'phone_priv', $partnerObj->phone_priv('e'));
    $phone_priv_radio->setDescription(_CO_SPARTNER_CONTACT_PHONEPRIV_DSC);
    $sform->addElement($phone_priv_radio);
    // ADRESS
    //$adress_text = new XoopsFormText(_CO_SPARTNER_ADRESS, 'adress', 50, 255, $partnerObj->adress('e'));
    $adress_text = new XoopsFormTextArea(_CO_SPARTNER_ADRESS, 'adress', $partnerObj->adress('e'));
    $adress_text->setDescription(_CO_SPARTNER_ADRESS_DSC);
    $sform->addElement($adress_text, false);
    // ADRESS_PRIV
    $adress_priv_radio = new XoopsFormRadioYN(_CO_SPARTNER_CONTACT_ADRESSPRIV, 'adress_priv', $partnerObj->adress_priv('e'));
    $adress_priv_radio->setDescription(_CO_SPARTNER_CONTACT_ADRESSPRIV_DSC);
    $sform->addElement($adress_priv_radio);
    // STATUS
    $options = $partnerObj->getAvailableStatus();
    $status_select = new XoopsFormSelect(_AM_SPARTNER_STATUS, 'status', $new_status);
    $status_select->addOptionArray($options);
    $status_select->setDescription(_AM_SPARTNER_STATUS_DSC);
    $sform->addElement($status_select);
    // WEIGHT
    $weight_text = new XoopsFormText(_AM_SPARTNER_WEIGHT, 'weight', 4, 4, $partnerObj->weight());
    $weight_text->setDescription(_AM_SPARTNER_WEIGHT_DSC);
    $sform->addElement($weight_text);
    //perms
    global $smartpermissions_handler;
    include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectpermission.php';
    $smartpermissions_handler = new SmartobjectPermissionHandler($smartpartner_partner_handler);
    if ($partnerObj->id() != 0) {
        $grantedGroups = $smartpermissions_handler->getGrantedGroups('full_view', $partnerObj->id());
    } else {
        $grantedGroups = $xoopsModuleConfig['default_full_view'];
    }
    $full_view_select = new XoopsFormSelectGroup(_CO_SPARTNER_FULL_PERM_READ, 'full_view', true, $grantedGroups, 5, true);
    $full_view_select->setDescription(_CO_SPARTNER_FULL_PERM_READ_DSC);
    $sform->addElement($full_view_select);
    if ($partnerObj->id() != 0) {
        $partGrantedGroups = $smartpermissions_handler->getGrantedGroups('partial_view', $partnerObj->id());
    } else {
        $partGrantedGroups = $xoopsModuleConfig['default_part_view'];
    }
    $part_view_select = new XoopsFormSelectGroup(_CO_SPARTNER_PART_PERM_READ, 'partial_view', true, $partGrantedGroups, 5, true);
    $part_view_select->setDescription(_CO_SPARTNER_PART_PERM_READ_DSC);
    $sform->addElement($part_view_select);
    // Partner id
    $sform->addElement(new XoopsFormHidden('id', $partnerObj->id()));
    $button_tray = new XoopsFormElementTray('', '');
    $hidden = new XoopsFormHidden('op', 'addpartner');
    $button_tray->addElement($hidden);
    $sform->addElement(new XoopsFormHidden('original_status', $partnerObj->status()));
    if (!$id) {
        // there's no id? Then it's a new partner
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SPARTNER_CREATE, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', _AM_SPARTNER_CREATE, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addpartner\'"');
        $button_tray->addElement($butt_create);
        $butt_clear = new XoopsFormButton('', '', _AM_SPARTNER_CLEAR, 'reset');
        $button_tray->addElement($butt_clear);
        $butt_cancel = new XoopsFormButton('', '', _AM_SPARTNER_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
    } else {
        // else, we're editing an existing partner
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SPARTNER_MODIFY, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', $button_caption, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addpartner\'"');
        $button_tray->addElement($butt_create);
        $butt_cancel = new XoopsFormButton('', '', _AM_SPARTNER_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
    }
    $sform->addElement($button_tray);
    $sform->display();
    unset($hidden);
    if (!$id) {
        smartpartner_close_collapsable('addpartner', 'addpartnericon');
    } else {
        smartpartner_close_collapsable('editpartner', 'editpartnericon');
    }
    if ($id != 0) {
        showfiles($partnerObj);
    }
}
Esempio n. 10
0
/**
* $Id: partners_list.php,v 1.6 2005/04/21 15:09:31 malanciault Exp $
* Module: SmartPartner
* Author: The SmartFactory <www.smartfactory.ca>
* Licence: GNU
*/
function b_partners_list_show($options)
{
    // This must contain the name of the folder in which reside SmartPartner
    if (!defined("SMARTPARTNER_DIRNAME")) {
        define("SMARTPARTNER_DIRNAME", 'smartpartner');
    }
    include_once XOOPS_ROOT_PATH . "/modules/" . SMARTPARTNER_DIRNAME . "/include/common.php";
    // Creating the partner handler object
    $partner_handler =& smartpartner_gethandler('partner');
    if ($options[2]) {
        // Randomize
        $partnersObj =& $partner_handler->getPartners(0, 0, _SPARTNER_STATUS_ACTIVE);
        if (count($partnersObj) > 1) {
            $key_arr = array_keys($partnersObj);
            $key_rand = array_rand($key_arr, count($key_arr));
            for ($i = 0; $i < count($partnersObj) && $i < $options[3]; $i++) {
                $newObjs[$i] = $partnersObj[$key_rand[$i]];
            }
            $partnersObj = $newObjs;
        }
    } else {
        $partnersObj =& $partner_handler->getPartners($options[3], 0, _SPARTNER_STATUS_ACTIVE, $options[5], $options[6]);
        if (count($partnersObj) > 1 && $options[2] == 1) {
            $key_arr = array_keys($partnersObj);
            $key_rand = array_rand($key_arr, count($key_arr));
            for ($i = 0; $i < count($partnersObj); $i++) {
                $newObjs[$i] = $partnersObj[$key_rand[$i]];
            }
            $partnersObj = $newObjs;
        }
    }
    $block = array();
    if ($partnersObj) {
        for ($i = 0; $i < count($partnersObj); $i++) {
            $partner['id'] = $partnersObj[$i]->id();
            $partner['urllink'] = $partnersObj[$i]->getUrlLink('block');
            if ($partnersObj[$i]->image() && ($options[4] == 1 || $options[4] == 3)) {
                $partner['image'] = $partnersObj[$i]->getImageUrl();
            }
            if ($partnersObj[$i]->image() && ($options[4] == 2 || $options[4] == 3)) {
                $partner['title'] = $partnersObj[$i]->title();
            } else {
                $partner['title'] = '';
            }
            $smartConfig =& smartpartner_getModuleConfig();
            $image_info = smartpartner_imageResize($partnersObj[$i]->getImagePath(), $smartConfig['img_max_width'], $smartConfig['img_max_height']);
            $partner['img_attr'] = $image_info[3];
            $partner['extendedInfo'] = $partnersObj[$i]->extentedInfo();
            $block['partners'][] = $partner;
        }
        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_SPARTNER_LANG_SEE_ALL;
        $block['smartpartner_url'] = SMARTPARTNER_URL;
    }
    return $block;
}
Esempio n. 11
0
<?php

/**
* $Id: common.php,v 1.6 2005/03/21 22:57:53 malanciault Exp $
* Module: SmartPartner
* Author: The SmartFactory <www.smartfactory.ca>
* Licence: GNU
*/
// This must contain the name of the folder in which reside SmartPartner
if (!defined("SMARTPARTNER_DIRNAME")) {
    define("SMARTPARTNER_DIRNAME", 'smartpartner');
}
if (!defined("SMARTPARTNER_URL")) {
    define("SMARTPARTNER_URL", XOOPS_URL . '/modules/' . SMARTPARTNER_DIRNAME . '/');
}
if (!defined("SMARTPARTNER_ROOT_PATH")) {
    define("SMARTPARTNER_ROOT_PATH", XOOPS_ROOT_PATH . '/modules/' . SMARTPARTNER_DIRNAME . '/');
}
include_once SMARTPARTNER_ROOT_PATH . "include/functions.php";
include_once SMARTPARTNER_ROOT_PATH . "class/keyhighlighter.class.php";
// Creating the partner handler object
$GLOBALS['partner_handler'] = smartpartner_gethandler('partner');
Esempio n. 12
0
{
    global $xoopsConfig, $xoopsModuleConfig, $xoopsModule;
    echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'>";
    echo "<tr>";
    echo "<td class='bg3' width='200px' align='left'><b>" . _AM_SPARTNER_NAME . "</b></td>";
    echo "<td width='' class='bg3' align='left'><b>" . _AM_SPARTNER_INTRO . "</b></td>";
    echo "<td width='90' class='bg3' align='center'><b>" . _AM_SPARTNER_HITS . "</b></td>";
    echo "<td width='90' class='bg3' align='center'><b>" . _AM_SPARTNER_STATUS . "</b></td>";
    echo "<td width='90' class='bg3' align='center'><b>" . _AM_SPARTNER_ACTION . "</b></td>";
    echo "</tr>";
}
// Code for the page
include_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
// Creating the Partner handler object
$partner_handler =& smartpartner_gethandler('partner');
$startentry = isset($_GET['startentry']) ? intval($_GET['startentry']) : 0;
xoops_cp_header();
global $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule;
smartpartner_adminMenu(0, _AM_SPARTNER_INDEX);
// Total Partners -- includes everything on the table
$totalpartners = $partner_handler->getPartnerCount(_SPARTNER_STATUS_ALL);
// Total Submitted Partners
$totalsubmitted = $partner_handler->getPartnerCount(_SPARTNER_STATUS_SUBMITTED);
// Total active Partners
$totalactive = $partner_handler->getPartnerCount(_SPARTNER_STATUS_ACTIVE);
// Total inactive Partners
$totalinactive = $partner_handler->getPartnerCount(_SPARTNER_STATUS_INACTIVE);
// Total rejected Partners
$totalrejected = $partner_handler->getPartnerCount(_SPARTNER_STATUS_REJECTED);
// Check Path Configuration
Esempio n. 13
0
* Licence: GNU
*/
include "header.php";
// At which record shall we start
$start = isset($_GET['start']) ? intval($_GET['start']) : 0;
if (strpos($_SERVER['REQUEST_URI'], 'odules/') > 0) {
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: " . XOOPS_URL . "/associates/{$start}");
    exit;
}
$xoopsOption['template_main'] = 'smartpartner_index.html';
include XOOPS_ROOT_PATH . "/header.php";
include "footer.php";
global $myts;
// Creating the partner handler object
$partner_handler =& smartpartner_gethandler('partner', SMARTPARTNER_DIRNAME);
$partners_total = $partner_handler->getPartnerCount();
$partnersObj =& $partner_handler->getPartners($xoopsModuleConfig['perpage_user'], $start, _SPARTNER_STATUS_ACTIVE, $xoopsModuleConfig['index_sortby'], $xoopsModuleConfig['index_orderby']);
$partners_total_onpage = count($partnersObj);
$partners = array();
if ($partnersObj) {
    for ($i = 0; $i < $partners_total_onpage; $i++) {
        $partner = $partnersObj[$i]->toArray();
        $partners[] = $partner;
    }
}
$xoopsTpl->assign('partners', $partners);
// Partners Navigation Bar
$pagenav = new XoopsPageNav($partners_total, $xoopsModuleConfig['perpage_user'], $start, 'start', '');
$xoopsTpl->assign('pagenav', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>');
$xoopsTpl->assign('navitem', 3);
Esempio n. 14
0
 function delete($category, $force = false)
 {
     /*if (parent::delete($object, $force)) {
                 global $xoopsModule;
     
                 // TODO : Delete partners in this category
     
                 return true;
             }
             return false;*/
     if (strtolower(get_class($category)) != 'smartpartnercategory') {
         return false;
     }
     // Deleting the partners
     global $smartpartner_partner_handler;
     if (!isset($smartpartner_partner_handler)) {
         $smartpartner_partner_handler =& smartpartner_gethandler('partner');
     }
     $criteria = new Criteria('category', $category->categoryid());
     $partners =& $smartpartner_partner_handler->getObjects($criteria);
     if ($partners) {
         foreach ($partners as $partner) {
             $smartpartner_partner_handler->delete($partner);
         }
     }
     // Deleteing the sub categories
     $subcats =& $this->getCategories(0, 0, $category->categoryid());
     foreach ($subcats as $subcat) {
         $this->delete($subcat);
     }
     $sql = sprintf("DELETE FROM %s WHERE categoryid = %u ", $this->db->prefix("smartpartner_categories"), $category->getVar('categoryid'));
     if (false != $force) {
         $result = $this->db->queryF($sql);
     } else {
         $result = $this->db->query($sql);
     }
     if (!$result) {
         return false;
     }
     return true;
 }
Esempio n. 15
0
}
include_once SMARTPARTNER_ROOT_PATH . "include/functions.php";
include_once SMARTPARTNER_ROOT_PATH . "include/seo_functions.php";
include_once SMARTPARTNER_ROOT_PATH . "include/metagen.php";
include_once SMARTPARTNER_ROOT_PATH . "class/keyhighlighter.class.php";
include_once SMARTPARTNER_ROOT_PATH . "class/session.php";
/** Include SmartObject framework **/
include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartloader.php';
include_once SMARTOBJECT_ROOT_PATH . "class/smartobjectcategory.php";
// Creating the SmartModule object
$smartModule =& smartpartner_getModuleInfo();
// Find if the user is admin of the module
$smartpartner_isAdmin = smartpartner_userIsAdmin();
$myts = MyTextSanitizer::getInstance();
$smartpartner_moduleName = $smartModule->getVar('name');
// Creating the SmartModule config Object
$smartConfig =& smartpartner_getModuleConfig();
// Creating the partner handler object
$smartpartner_partner_handler =& smartpartner_gethandler('partner');
// Creating the category handler object
$smartpartner_category_handler =& smartpartner_gethandler('category');
// Creating the category link handler object
$smartpartner_partner_cat_link_handler =& smartpartner_gethandler('partner_cat_link');
// Creating the offer handler object
$smartpartner_offer_handler =& smartpartner_gethandler('offer');
// Creating the file handler object
$smartpartner_file_handler =& smartpartner_gethandler('file');
define('_SPARTNER_STATUS_OFFLINE', 0);
define('_SPARTNER_STATUS_ONLINE', 1);
$statusArray = array(_SPARTNER_STATUS_OFFLINE => _CO_SPARTNER_STATUS_OFFLINE, _SPARTNER_STATUS_ONLINE => _CO_SPARTNER_STATUS_ONLINE);
include_once SMARTPARTNER_ROOT_PATH . "class/smarttree.php";
Esempio n. 16
0
function b_partners_list_show($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/smartpartner/include/common.php";
    // Creating the partner handler object
    $smartpartner_partner_handler =& smartpartner_gethandler('partner');
    $smartpartner_category_handler =& smartpartner_gethandler('category');
    // Randomize
    $partnersObj =& $smartpartner_partner_handler->getPartners(0, 0, _SPARTNER_STATUS_ACTIVE);
    if (count($partnersObj) > 1) {
        $key_arr = array_keys($partnersObj);
        $key_rand = array_rand($key_arr, count($key_arr));
        for ($i = 0; $i < count($partnersObj) && ($options[2] == 0 || $i < $options[2]); $i++) {
            $newObjs[$i] = $partnersObj[$key_rand[$i]];
        }
        $partnersObj = $newObjs;
    }
    $cat_id = array();
    foreach ($partnersObj as $partnerObj) {
        $p_cats = $partnerObj->categoryid();
        $p_cat_rand = array_rand(explode('|', $p_cats));
        if (!in_array($p_cats[$p_cat_rand], $cat_id)) {
            $cat_id[] = $p_cats[$p_cat_rand];
        }
        //partner belong to only one category in the block
        $partnerObj->setVar('categoryid', $p_cats[$p_cat_rand]);
    }
    $block = array();
    if ($partnersObj) {
        for ($j = 0; $j < count($cat_id); $j++) {
            $categoryObj = $smartpartner_category_handler->get($cat_id[$j]);
            $block['categories'][$cat_id[$j]]['link'] = $cat_id[$j] != 0 ? $categoryObj->getCategoryLink() : false;
            for ($i = 0; $i < count($partnersObj); $i++) {
                //if(in_array($cat_id[$j], explode('|', $partnersObj[$i]->categoryid()))){
                if ($partnersObj[$i]->categoryid() == $cat_id[$j]) {
                    $partner['id'] = $partnersObj[$i]->id();
                    $partner['urllink'] = $partnersObj[$i]->getUrlLink('block');
                    if ($partnersObj[$i]->image() && ($options[3] == 1 || $options[3] == 3)) {
                        $partner['image'] = $partnersObj[$i]->getImageUrl();
                    }
                    if ($partnersObj[$i]->image() && ($options[3] == 2 || $options[3] == 3)) {
                        $partner['title'] = $partnersObj[$i]->title();
                    } else {
                        $partner['title'] = '';
                    }
                    $smartConfig =& smartpartner_getModuleConfig();
                    $image_info = smartpartner_imageResize($partnersObj[$i]->getImagePath(), $smartConfig['img_max_width'], $smartConfig['img_max_height']);
                    $partner['img_attr'] = $image_info[3];
                    $partner['extendedInfo'] = $partnersObj[$i]->extentedInfo();
                    $block['categories'][$cat_id[$j]]['partners'][] = $partner;
                }
            }
        }
        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[6];
        $block['lang_see_all'] = _MB_SPARTNER_LANG_SEE_ALL;
        $block['smartpartner_url'] = SMARTPARTNER_URL;
    }
    return $block;
}
Esempio n. 17
0
 /**
  * retrieve Partners from the database
  *
  * @param object $criteria {@link CriteriaElement} conditions to be met
  * @param bool $id_as_key use the partnerid as key for the array?
  * @return array array of {@link SmartpartnerPartner} objects
  */
 function &getObjects($criteria = null, $id_as_key = false)
 {
     $ret = array();
     $limit = $start = 0;
     $sql = 'SELECT * FROM ' . $this->table;
     if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
         $whereClause = $criteria->renderWhere();
         if ($whereClause != 'WHERE ()') {
             $sql .= ' ' . $criteria->renderWhere();
             if ($criteria->getSort() != '') {
                 $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
             }
             $limit = $criteria->getLimit();
             $start = $criteria->getStart();
         }
     }
     //echo "<br />" . $sql . "<br />";exit;
     $result = $this->db->query($sql, $limit, $start);
     if (!$result) {
         return $ret;
     }
     if (count($result) == 0) {
         return $ret;
     }
     global $smartpartner_partner_cat_link_handler;
     if (!isset($smartpartner_partner_cat_link_handler)) {
         $smartpartner_partner_cat_link_handler =& smartpartner_gethandler('partner_cat_link');
     }
     while ($myrow = $this->db->fetchArray($result)) {
         $partner = new SmartpartnerPartner();
         $partner->assignVars($myrow);
         if (!$id_as_key) {
             $ret[] =& $partner;
         } else {
             $ret[$myrow['id']] =& $partner;
         }
         $partner->setVar('categoryid', $smartpartner_partner_cat_link_handler->getParentIds($partner->getVar('id')));
         unset($partner);
     }
     return $ret;
 }