Example #1
0
 function getSQLFilter($field, $filter, $tableAlias = null)
 {
     $cfg = CustomFieldsFactory::getConfig();
     $db = JFactory::getDBO();
     if ($tableAlias) {
         $table_alias = $tableAlias . ".";
     } else {
         $table_alias = isset($cfg['aliases'][$field->own_table]) ? $cfg['aliases'][$field->own_table] . "." : "";
     }
     $sql = " " . $table_alias . $field->db_name . "=" . $db->quote($filter);
     return $sql;
 }
Example #2
0
 static function editEndDate(&$auction, $isAdmin = false)
 {
     $cfg = BidsHelperTools::getConfig();
     $dateFormat = BidsHelperDateTime::dateFormatConvert2JHTML(false);
     $fType = CustomFieldsFactory::getFieldType('date');
     $calendarFormat = $fType->dateFormatConversion($dateFormat);
     $dateFormat = BidsHelperDateTime::dateFormatConvert2JHTML(false);
     if (!$cfg->bid_opt_enable_date) {
         if ($auction->id && $auction->published) {
             $html = JHTML::date(JFactory::getDate($auction->end_date)->toUnix(), $dateFormat);
         } else {
             $tooltipMsg = array();
             if (intval($cfg->bid_opt_default_period) > 0) {
                 $tooltipMsg[] = JText::_('COM_BIDS_AUTO_END_DATE_TOOLTIP_1') . ' ' . $cfg->bid_opt_default_period . ' ' . JText::_('COM_BIDS_DAYS');
             }
             if ($cfg->bid_opt_allow_proxy && intval($cfg->bid_opt_proxy_default_period) > 0) {
                 $tooltipMsg[] = JText::_('COM_BIDS_AUTO_END_DATE_TOOLTIP_2') . ' ' . $cfg->bid_opt_proxy_default_period . ' ' . JText::_('COM_BIDS_DAYS');
             }
             if (($cfg->bid_opt_global_enable_bin || $cfg->bid_opt_enable_bin_only) && intval($cfg->bid_opt_bin_default_period) > 0) {
                 $tooltipMsg[] = JText::_('COM_BIDS_AUTO_END_DATE_TOOLTIP_3') . ' ' . $cfg->bid_opt_bin_default_period . ' ' . JText::_('COM_BIDS_DAYS');
             }
             if ($cfg->bid_opt_global_enable_reserve_price && intval($cfg->bid_opt_reserve_price_default_period) > 0) {
                 $tooltipMsg[] = JText::_('COM_BIDS_AUTO_END_DATE_TOOLTIP_4') . ' ' . $cfg->bid_opt_reserve_price_default_period . ' ' . JText::_('COM_BIDS_DAYS');
             }
             $html = count($tooltipMsg) ? JHtml::tooltip(implode('<br />', $tooltipMsg)) : '-';
         }
     } else {
         if ($auction->published && !$isAdmin) {
             $html = JHTML::date(JFactory::getDate($auction->end_date)->toUnix(), $dateFormat);
         } else {
             $attribs = array('class' => 'inputbox required validate-start-date');
             $date = $auction->end_date ? $auction->end_date : '';
             $d = $date ? $date : '';
             if (preg_match('/^[0-9][0-9]:[0-9][0-9]$/', $date)) {
                 //if it's only end hour
                 $d = "";
             }
             $html = JHTML::calendar($d, 'end_date', 'end_date', $calendarFormat, $attribs);
             if ($d) {
                 $html = str_replace(' value="' . htmlspecialchars($d, ENT_COMPAT, 'UTF-8') . '"', ' value="' . htmlspecialchars(JHtml::date($d, $cfg->bid_opt_date_format, false), ENT_COMPAT, 'UTF-8') . '"', $html);
             }
             if ($cfg->bid_opt_enable_hour) {
                 $endHours = $auction->end_date ? JHTML::date($auction->end_date, 'H') : '00';
                 $endMinutes = $auction->end_date ? JHTML::date($auction->end_date, 'i') : '00';
                 $html .= '&nbsp;<input name="end_hour" size="1" value="' . $endHours . '" maxlength="2" class="inputbox required" onblur="bidCheckHours(this)" /> :
                     <input name="end_minutes" size="1" value="' . $endMinutes . '" maxlength="2" class="inputbox required" onblur="bidCheckMinutes(this)" />';
             }
             $html .= '&nbsp;' . JHtml::image(JUri::root() . 'components/com_bids/images/requiredfield.gif', 'Required');
         }
     }
     return $html;
 }
Example #3
0
 function _buildWhere($filters)
 {
     $integrationArray = $this->getIntegrationArray();
     $fields = CustomFieldsFactory::getSearchableFieldsList("user_profile");
     /*
         HUH?
             for($i=0;$i<count($fields);$i++)
                 $integrationArray[$fields[$i]["row_id"]]=$fields[$i]["row_id"];
     */
     $where = array();
     if (count($filters)) {
         foreach ($filters as $key => $value) {
             if (is_array($value)) {
                 foreach ($value as $k => $v) {
                     if (isset($integrationArray[$k]) && $integrationArray[$k]) {
                         if (strpos($v, '%') !== FALSE) {
                             $w[] = 'profile.' . $integrationArray[$k] . " LIKE '{$v}'";
                         } else {
                             $w[] = 'profile.' . $integrationArray[$k] . "='{$v}'";
                         }
                     }
                     if ($k == 'username') {
                         if (strpos($v, '%') !== FALSE) {
                             $w[] = "u.username LIKE '{$v}'";
                         } else {
                             $w[] = "u.username='******'";
                         }
                     }
                 }
                 if (count($w)) {
                     $where[] = '(' . implode(' OR ', $w) . ')';
                 }
             } else {
                 if (isset($integrationArray[$key]) && $integrationArray[$key]) {
                     if (strpos($value, '%') !== FALSE) {
                         $where[] = 'profile.' . $integrationArray[$key] . " LIKE '{$value}'";
                     } else {
                         $where[] = 'profile.' . $integrationArray[$key] . "='{$value}'";
                     }
                 }
                 if ($key == 'username') {
                     if (strpos($v, '%') !== FALSE) {
                         $w[] = "u.username LIKE '{$v}'";
                     } else {
                         $w[] = "u.username='******'";
                     }
                 }
             }
         }
     }
     return $where;
 }
Example #4
0
 function getSQLFilter($field, $filter, $tableAlias)
 {
     $cfg = CustomFieldsFactory::getConfig();
     $db = JFactory::getDBO();
     $filter = (array) $filter;
     if ($tableAlias) {
         $table_alias = $tableAlias . ".";
     } else {
         $table_alias = isset($cfg['aliases'][$field->own_table]) ? $cfg['aliases'][$field->own_table] . "." : "";
     }
     $sql = array();
     foreach ($filter as $v) {
         $sql[] = "(" . $table_alias . $field->db_name . " = " . $db->quote($v) . ")";
     }
     $ret = implode(' OR ', $sql);
     return $ret ? "({$ret})" : $ret;
 }
Example #5
0
    function display() {
        $app = JFactory::getApplication();
        // Get the page/component configuration
        $params = $app->getParams();
        $database = JFactory::getDBO();

        $searchType = $params->get("user_type");
        $this->assign("search_type", $searchType);


        if ($params->get('show_page_title', 1)) {

            $page_title = $this->escape($params->get('page_title'));
            if ($page_title == "") {
                $page_title = JText::_("COM_BIDS_SEARCH_USERS");
            }
            $this->assign("page_title", $page_title);
        }

        $extra_field_list = $params->get('extra_fields', array());

        $lists['country']["label"] = "Country";
        $lists['country']["html"] = BidsHelperHtml::selectCountry("country");

        JHTML::_('behavior.calendar');

        $profileMode = BidsHelperTools::getProfileMode();
        if('component'==$profileMode) {
            $fields = CustomFieldsFactory::getSearchableFieldsList('user_profile');
            $lists['custom_fields'] = JHtml::_('customfields.displaysearchhtml',$fields);
            //$this->assign('customFilters', $customFilters);
        }

        $lists["city"]["label"] = JText::_("COM_BIDS_CITY");
        $lists["city"]["html"] = '<input type="text" name="city" />';
        $lists["name"]["label"] = JText::_('COM_BIDS_NAME');
        $lists["name"]["html"] = '<input type="text" name="name" />';

        $this->assign('lists', $lists);

        $this->assign("search_fields", $extra_field_list);

        parent::display('elements/search/t_search_users.tpl');
    }
Example #6
0
 function createHTMLObjectsForField($field)
 {
     $lists = new JObject();
     $cfg = CustomFieldsFactory::getConfig();
     $lists->curent_type = null;
     $lists->field_options = array();
     $lists->field_types = CustomFieldsFactory::getFieldTypesList();
     $opts = array();
     foreach ($lists->field_types as $typename) {
         $item = CustomFieldsFactory::getFieldType($typename);
         $opts[] = JHTML::_('select.option', $item->class_name, $item->type_name);
     }
     $lists->field_types_html = JHTML::_('select.genericlist', $opts, 'ftype', 'class="inputbox"', "value", "text", $field->ftype);
     $lists->field_pages_categories = $cfg['has_category'];
     $validators = CustomFieldsFactory::getValidatorsList();
     $opts = array(JHTML::_('select.option', "", JText::_("FACTORY_NONE")));
     foreach ($validators as $validator) {
         $validatorObj = CustomFieldsFactory::getFieldValidator($validator);
         $opts[] = JHTML::_('select.option', $validatorObj->classname, JText::_($validatorObj->name));
     }
     $lists->validate_type = JHTML::_('select.genericlist', $opts, 'validate_type', 'class="inputbox"', "value", "text", $field->validate_type);
     if ($field->ftype) {
         $lists->curent_type = CustomFieldsFactory::getFieldType($field->ftype);
         if ($lists->curent_type->has_options) {
             $lists->field_options = $field->getOptions();
         }
         $lists->curent_type_params = $lists->curent_type->get('_params');
     }
     if ($field->id) {
         //cannot change page for an existing field
         $lists->field_pages = $cfg['pages'][$field->page];
     } else {
         $opts = array();
         foreach ($cfg['pages'] as $k => $v) {
             $opts[] = JHTML::_('select.option', $k, $v);
         }
         $lists->field_pages = JHTML::_('select.genericlist', $opts, 'page', 'class="inputbox"', "value", "text", $field->page);
     }
     $lists->compulsory = JHTML::_("select.booleanlist", 'compulsory', " infoyes='" . JText::_('FACTORY_COMPULSORY_FIELD') . "' infono='" . JText::_('FACTORY_OPTIONAL_FIELD') . "'", $field->compulsory);
     $lists->search = JHTML::_("select.booleanlist", 'search', '', $field->search);
     $lists->status = JHTML::_("select.booleanlist", 'status', '', $field->status);
     return $lists;
 }
Example #7
0
    function display($tmpl) {

        $database = JFactory::getDBO();
        $my = JFactory::getUser();
        $cfg = BidsHelperTools::getConfig();

        $lists = array();

        $user = BidsHelperTools::getUserProfileObject($my->id);
        JFilterOutput::objectHTMLSafe( $user, ENT_QUOTES );

        $opts = array();
        $opts[] = JHTML::_('select.option', '', JText::_('COM_BIDS_CHOOSE_COUNTRY'));

        $database->setQuery("SELECT name AS value,name AS text FROM `#__bid_country` WHERE active=1 order by name");
        $opts = array_merge($opts, $database->loadObjectList());

        $lists["country"] = JHTML::_('select.genericlist', $opts, 'country', 'class="inputbox required"', 'value', 'text', $user->country);

        $lists['token'] = JHtml::_('form.token');

        $lists["validate_custom_fields"] = " new Array()";
        $lists["validate_custom_fields_count"] = "0";

        $fields = CustomFieldsFactory::getFieldsList("user_profile");
        $fields_html=JHtml::_('customfields.displayfieldshtml',$user,$fields);

        JHTML::_('behavior.formvalidation');
        JHTML::script(JURI::root().'components/com_bids/js/validator/validator.js');

        $formAction =
                ( !$my->id && 'component'==$cfg->bid_opt_registration_mode && 'component'==$cfg->bid_opt_profile_mode ) ?
                (JUri::root().'index.php?option=com_users&task=registration.register') :
                (JUri::root().'/index.php?option=com_bids&task=saveuserdetails') ;

        $this->assign("custom_fields_html", $fields_html );
        $this->assign("user", $user);
        $this->assign("formAction", $formAction);
        $this->assign("lists", $lists);

        parent::display($tmpl);
    }
Example #8
0
    function display() {

        $model = $this->getModel('auctions');

        $lists = array();
        $lists['users'] = JHTML::_('searchform.selectUsers',$model->getState('filters.users') );
        $lists['active_users'] = JHTML::_('searchform.selectActiveUsers', $model->getState('filters.username') );
        $lists['cats'] = JHTML::_('searchform.selectCategory', $model->getState('filters.cat') );
        $lists['tags'] = JHTML::_('searchform.inputTags', $model->getState('filters.tagnames') );
        $lists['after_calendar'] = JHTML::calendar($model->getState('filters.afterd'),'afterd','afterd','%Y-%m-%d');
        $lists['before_calendar'] = JHTML::calendar($model->getState('filters.befored'),'befored','befored','%Y-%m-%d');
        $lists['startprice'] = JHTML::_('searchform.inputPrice', 'startprice', $model->getState('filters.startprice') );
        $lists['endprice'] = JHTML::_('searchform.inputPrice', 'endprice', $model->getState('filters.endprice') );
        $lists['currency'] = JHTML::_('searchform.selectCurrency', 'currency', $model->getState('filters.currency'));
        $lists['inputReset'] = JHTML::_('searchform.inputReset');

        //filters for integration fields

        $profile = BidsHelperTools::getUserProfileObject();
        $integrationArray = $profile->getIntegrationArray();
        foreach($integrationArray as $alias=>$fieldName) {
            if(''!=$fieldName) {
                $lists[$alias] = JHTML::_('searchform._selectProfileIntegrationFilter', $fieldName, $model->getState('filters.user_profile%'.$fieldName) );
            }
        }

        JHTML::_('behavior.calendar');

        JHTML::script(JURI::root() . 'components/com_bids/js/auctions.js');

        $fields = CustomFieldsFactory::getSearchableFieldsList('auctions');
        $fields_html=JHtml::_('customfields.displaysearchhtml',$fields,'divs');

        $this->assign('lists', $lists);
        $this->assign("custom_fields_html", $fields_html );

        parent::display('t_search.tpl');
    }
Example #9
0
 function bind($src, $ignore = array())
 {
     $res = parent::bind($src, $ignore);
     if ($src == $_GET || $src == $_POST || $src == $_REQUEST) {
         if (!is_array($ignore)) {
             $ignore = explode(' ', $ignore);
         }
         $fieldObj = JTable::getInstance('FieldsTable', 'JTheFactory');
         foreach ($this->_custom_fields as $field) {
             if (!in_array($field->db_name, $ignore)) {
                 $fieldObj->bind($field);
                 $fieldPlugin = CustomFieldsFactory::getFieldType($field->ftype);
                 $val = $fieldPlugin->getValue($fieldObj, $src);
                 $this->{$field->db_name} = $val;
             }
         }
     }
     return $res;
 }
Example #10
0
 function buildCustomQuery(&$query, $profileObject = null, $useridField = null, $selectIntegrationFields = array())
 {
     $queriedTables = $query->getQueriedTables();
     $searchableFields = CustomFieldsFactory::getSearchableFieldsList();
     if ($profileObject) {
         //first look for Joomla's users table; join it only if not queried
         $usersAlias = array_search('#__users', $queriedTables);
         if (false === $usersAlias) {
             if (!$useridField) {
                 JError::raiseWarning(500, 'When using profile mode, the USERID foreign key is required!');
                 return;
             }
             $query->join('left', '#__users', 'u', $useridField . '=`u`.`id`');
             $usersAlias = 'u';
         }
         //join the extended profile table
         $tableName = $profileObject->getIntegrationTable();
         $tableKey = $profileObject->getIntegrationKey();
         $query->join('left', $tableName, 'ui', '`' . $usersAlias . '`.`id`=`ui`.`' . $tableKey . '`');
         //the listing includes some profile filters
         $this->pushProfileIntegrationFields($searchableFields, $profileObject);
         //we need to "refresh" this because of the previous joins
         $queriedTables = $query->getQueriedTables();
     }
     foreach ($searchableFields as $field) {
         $requestKey = $field->page . '%' . $field->db_name;
         $searchValue = $this->getState('filters.' . $requestKey);
         $fieldName = $field->db_name;
         $tableName = $field->own_table;
         $tableAlias = array_search($tableName, $queriedTables);
         if (false === $tableAlias) {
             //this IS a searchable field, but its parent table is not loaded in this context
             //i.e.: we use CB and this is a searchable CF for "component profile"
             continue;
         }
         //SELECT the field no matter what
         $query->select('`' . $tableAlias . '`.`' . $fieldName . '`');
         //no value from request => no SQL filter
         if (empty($searchValue)) {
             continue;
         }
         $ftype = CustomFieldsFactory::getFieldType($field->ftype ? $field->ftype : 'inputbox');
         $query->where($ftype->getSQLFilter($field, $searchValue, $tableAlias));
     }
     foreach ($selectIntegrationFields as $f) {
         $fieldName = $profileObject->getFilterField($f);
         $fieldTable = $profileObject->getFilterTable($f);
         $tableAlias = array_search($fieldTable, $queriedTables);
         if (!$fieldTable || !$tableAlias) {
             $query->select('NULL AS ' . $f);
         } else {
             $query->select('`' . $tableAlias . '`.`' . $fieldName . '` AS ' . $f);
         }
     }
 }
Example #11
0
    function display($tmpl=null) {

        JHtml::_('behavior.mootools');

        $jsRoot = JURI::root().'components/com_bids/js/jquery/';
        JHTML::script($jsRoot.'jquery.js');
        JHTML::script($jsRoot.'jquery.noconflict.js');
        JHTML::script($jsRoot.'clock/jquery.clock.js');

        $modelAuction = $this->getModel('auction');
        $auction = $modelAuction->get('auction');

        $auction->expired = false;

        $lists = array();

        $lists['title'] = JHTML::_('editauction.inputTitle',$auction);
        $lists['cats'] = JHTML::_('editauction.selectCategory',$auction);
        //$lists['cats']    = JHTML::_('factorycategory.select','cat','',$auction->cat,false,false,true);
        $lists['published'] = JHTML::_('editauction.selectPublished',$auction);
        $lists['tags'] = JHTML::_('editauction.inputTags',$auction);
        $lists['shortDescription'] = JHTML::_('editauction.inputShortDescription',$auction);
        $lists['description'] = JHTML::_('editauction.inputDescription',$auction);
        $lists['auctiontype'] = JHTML::_('editauction.selectAuctionType',$auction);
        $lists['automatic'] = JHTML::_('editauction.inputAutomatic',$auction);
        $lists['binType'] = JHTML::_('editauction.selectBINType',$auction);
        $lists['binPrice'] = JHTML::_('editauction.inputBINPrice',$auction);
        $lists['autoAcceptBIN'] = JHTML::_('editauction.selectAutoAcceptBIN',$auction);
        $lists['quantity'] = JHTML::_('editauction.inputQuantity',$auction);
        $lists['enableSuggestions'] = JHTML::_('editAuction.selectEnableSuggestions',$auction);
        $lists['minNumberSuggestions'] = JHTML::_('editAuction.inputMinNumberSuggestions',$auction);
        $lists['currency'] = JHTML::_('editauction.selectCurrency',$auction);
        $lists['initialPrice'] = JHTML::_('editauction.inputInitialPrice',$auction);
        $lists['showMaxPrice'] = JHTML::_('editauction.selectShowMaxPrice',$auction);
        $lists['showNumberBids'] = JHTML::_('editauction.selectShowNumberBids',$auction);
        $lists['reservePrice'] = JHTML::_('editauction.inputReservePrice',$auction);
        $lists['showReservePrice'] = JHTML::_('editauction.selectShowReservePrice',$auction);
        $lists['minIncrease'] = JHTML::_('editauction.inputMinIncrease',$auction);
        $lists['shippingPrice'] = JHTML::_('editAuction.inputShipmentPrice',$auction);
        $lists['uploadImages'] = JHTML::_('editauction.uploadImages',$auction);
        $lists['paymentInfo'] = JHTML::_('editauction.textPaymentInfo',$auction);
        $lists['shipmentInfo'] = JHTML::_('editauction.textShipmentInfo',$auction);
        //$lists[''] = JHTML::_('editauction.',$auction);


        $lists['currentLocalTime_field'] = JHTML::_('editAuction.currentLocalTime',$auction);
        $lists['startDate_field'] = JHTML::_('editAuction.editStartDate',$auction);
        $lists['endDate_field'] = JHTML::_('editAuction.editEndDate',$auction);
        $lists['editFormTitle'] = JHTML::_('editAuction.formTitle',$auction);

        $auction->links = JHTML::_('auctiondetails.createLinks',$auction);

        $fields = CustomFieldsFactory::getFieldsList("auctions");
        $fields_html = JHtml::_('listauctions.displayfieldshtml',$auction,$fields);
        $custom_fields_with_cat = $modelAuction->getNrFieldsWithFilters();

        JTheFactoryEventsHelper::triggerEvent('onBeforeEditAuction',array($auction));

        $this->assign("custom_fields", $fields );
        $this->assign("custom_fields_html", $fields_html );
        $this->assign("custom_fields_with_cat", $custom_fields_with_cat?1:0);

        $this->assign('lists', $lists);
        $this->assign('auction', $auction);

        parent::display($tmpl);
    }
Example #12
0
 static function DisplayFieldsHtml(&$row, $fieldlist, $style = 'div')
 {
     if (!count($fieldlist)) {
         return null;
     }
     $page = $fieldlist[0]->page;
     $cfg = CustomFieldsFactory::getConfig();
     $category_filter = array();
     if ($cfg['has_category'][$page]) {
         $db = JFactory::getDBO();
         $db->setQuery("SELECT fid FROM #__" . APP_PREFIX . "_fields_categories WHERE cid = '" . $row->cat . "'");
         $category_filter = $db->loadResultArray();
     }
     $flist = array();
     $field_object = JTable::getInstance('FieldsTable', 'JTheFactory');
     foreach ($fieldlist as $field) {
         if ($field->categoryfilter && !in_array($field->id, $category_filter)) {
             continue;
         }
         $field_type = CustomFieldsFactory::getFieldType($field->ftype);
         $field_object->bind($field);
         $f = new stdClass();
         $f->field = clone $field;
         $f->value = $row->{$field->db_name};
         $f->html = $field_type->getFieldHTML($field_object, $row->{$field->db_name});
         $flist[] = $f;
     }
     $func = 'DisplayFieldsHtml_' . ucfirst($style);
     $html = self::$func($flist);
     return $html;
 }
Example #13
0
 function display($id)
 {
     $database = JFactory::getDBO();
     $my = JFactory::getUser();
     $modelAuction = $this->getModel('auction');
     $auction = $modelAuction->get('auction');
     $lists = array();
     $lang = JFactory::getLanguage();
     $lang->load('com_bids', JPATH_SITE);
     $bidCfg = BidsHelperTools::getConfig();
     $lists = array();
     $lists['title'] = JHTML::_('editauction.inputTitle', $auction, 1);
     $lists['cats'] = JHTML::_('editauction.selectCategory', $auction, 1);
     //$lists['cats']    = JHTML::_('factorycategory.select','cat','',$auction->cat,false,false,true);
     $lists['published'] = JHTML::_('editauction.selectPublished', $auction, 1);
     $lists['tags'] = JHTML::_('editauction.inputTags', $auction, 1);
     $lists['shortDescription'] = JHTML::_('editauction.inputShortDescription', $auction, 1);
     $lists['description'] = JHTML::_('editauction.inputDescription', $auction, 1);
     $lists['auctiontype'] = JHTML::_('editauction.selectAuctionType', $auction, 1);
     $lists['automatic'] = JHTML::_('editauction.inputAutomatic', $auction, 1);
     $lists['binType'] = JHTML::_('editauction.selectBINType', $auction, 1);
     $lists['binPrice'] = JHTML::_('editauction.inputBINPrice', $auction, 1);
     $lists['autoAcceptBIN'] = JHTML::_('editauction.selectAutoAcceptBIN', $auction, 1);
     $lists['quantity'] = JHTML::_('editauction.inputQuantity', $auction, 1);
     $lists['enableSuggestions'] = JHTML::_('editAuction.selectEnableSuggestions', $auction, 1);
     $lists['minNumberSuggestions'] = JHTML::_('editAuction.inputMinNumberSuggestions', $auction, 1);
     $lists['currency'] = JHTML::_('editauction.selectCurrency', $auction, 1);
     $lists['initialPrice'] = JHTML::_('editauction.inputInitialPrice', $auction, 1);
     $lists['showMaxPrice'] = JHTML::_('editauction.selectShowMaxPrice', $auction, 1);
     $lists['showNumberBids'] = JHTML::_('editauction.selectShowNumberBids', $auction, 1);
     $lists['reservePrice'] = JHTML::_('editauction.inputReservePrice', $auction, 1);
     $lists['showReservePrice'] = JHTML::_('editauction.selectShowReservePrice', $auction, 1);
     $lists['minIncrease'] = JHTML::_('editauction.inputMinIncrease', $auction, 1);
     $lists['shippingPrice'] = JHTML::_('editAuction.inputShipmentPrice', $auction, 1);
     $lists['uploadImages'] = JHTML::_('editauction.uploadImages', $auction, 1);
     $lists['paymentInfo'] = JHTML::_('editauction.textPaymentInfo', $auction, 1);
     $lists['shipmentInfo'] = JHTML::_('editauction.textShipmentInfo', $auction, 1);
     //$lists[''] = JHTML::_('editauction.',$auction);
     $lists['currentLocalTime_field'] = JHTML::_('editAuction.currentLocalTime', $auction);
     $lists['startDate_field'] = JHTML::_('editAuction.editStartDate', $auction, 1);
     $lists['endDate_field'] = JHTML::_('editAuction.editEndDate', $auction, 1);
     $lists['editFormTitle'] = JHTML::_('editAuction.formTitle', $auction);
     $auction->links = JHTML::_('auctiondetails.createLinks', $auction);
     $fields = CustomFieldsFactory::getFieldsList("auctions");
     $fields_html = JHtml::_('listauctions.displayfieldshtml', $auction, $fields);
     $custom_fields_with_cat = $modelAuction->getNrFieldsWithFilters();
     $this->assign("custom_fields", $fields);
     $this->assign("custom_fields_html", $fields_html);
     $this->assign("custom_fields_with_cat", $custom_fields_with_cat ? 1 : 0);
     $this->assign('lists', $lists);
     $this->assign('auction', $auction);
     $this->assign('bidCfg', $bidCfg);
     JHtml::_('behavior.framework');
     JHtml::_('behavior.tooltip');
     JHtml::_('behavior.calendar');
     JHTML::_('behavior.formvalidation');
     JHtml::script(JURI::root() . 'components/com_bids/js/auctions.js');
     JHtml::script(JURI::root() . 'components/com_bids/js/date.js');
     JHtml::script(JURI::root() . 'components/com_bids/js/multifile.js');
     JHtml::script(JURI::root() . 'components/com_bids/js/auction_edit.js');
     JHtml::script(JURI::root() . 'components/com_bids/js/jquery/jquery.js');
     JHtml::script(JURI::root() . 'components/com_bids/js/jquery/jquery.noconflict.js');
     JHTML::script(JURI::root() . 'components/com_bids/js/jquery/clock/jquery.clock.js');
     JHtml::script(JURI::base() . 'index.php?option=com_bids&task=jsgen&view=editauction&format=raw');
     JHtml::stylesheet(JURI::root() . 'components/com_bids/templates/default/bid_template.css');
     $user = BidsHelperTools::getUserProfileObject($auction->userid);
     $auction->userdetails = $user;
     $query = "update #__bid_messages set wasread=1 where userid2='{$my->id}' and auction_id='{$id}'";
     $database->setQuery($query);
     $database->query();
     $query = "update #__bid_auctions set newmessages=0 where id='{$id}'";
     $database->setQuery($query);
     $database->query();
     $feat[] = JHTML::_('select.option', 'none', JText::_('COM_BIDS_NONE'));
     $feat[] = JHTML::_('select.option', 'featured', JText::_('COM_BIDS_PAYMENT_FEATURED'));
     $lists['featured'] = JHTML::_('select.genericlist', $feat, 'featured', 'class="inputbox" id="featured" style="width:120px;"', 'value', 'text', $auction->featured);
     $database = JFactory::getDBO();
     $my = JFactory::getUser();
     $database->setQuery("select max(bid_price) from #__bids where auction_id='{$auction->id}'");
     $auction->max_bid = $database->loadResult();
     $database->setQuery("select * from #__bid_pictures where auction_id='{$auction->id}'");
     $photos = $database->loadObjectList();
     $query = "select m.*,u1.username as fromuser, u2.username as touser  from #__bid_messages m\r\n                            left join #__users u1 on u1.id = m.userid1\r\n                            left join #__users u2 on u2.id = m.userid2\r\n                            where m.auction_id='{$auction->id}'\r\n\r\n            ";
     // and (m.userid1 = '$my->id' or m.userid2 = '$my->id') */
     $database->setQuery($query);
     $adminMessages = $database->loadObjectList();
     $query = "\r\n            SELECT a.*,b.username, bp.max_proxy_price\r\n            FROM `#__bids` AS a\r\n            LEFT JOIN `#__users` b\r\n                ON a.userid=b.id\r\n            LEFT JOIN `#__bid_proxy` AS bp\r\n                ON a.id_proxy=bp.id AND bp.active=1\r\n            WHERE a.auction_id=" . intval($auction->id);
     $database->setQuery($query);
     $bids = $database->loadObjectList();
     JHTML::_('behavior.modal');
     JHTML::_('behavior.tooltip');
     jimport('joomla.filesystem.file');
     $this->assignRef('lists', $lists);
     $this->assignRef('bids', $bids);
     $this->assignRef('adminMessages', $adminMessages);
     $this->assignRef('photos', $photos);
     $this->assignRef('user', $user);
     $this->assignRef('auction', $auction);
     parent::display();
 }
Example #14
0
    function smarty_positions($params, &$smarty) {
        if(!isset($params['position']) || empty($params['position']))
            return null;
        if(!isset($params['item']) || empty($params['item']))
            return null;
        $item=$params['item'];
        $page=(isset($params['page']))?$params['page']:"";
        $catfield=null;
        if (is_callable(array($item,'getCategoryField')))
            $catfield=$item->getCategoryField(); //make sure proper object is passed
        if (is_object($item)) $item=get_object_vars($item);

        $position=$params['position'];
        $template_file=$smarty->get_template_vars('template_file');
        JTheFactoryHelper::modelIncludePath('positions');
        $model= JModelLegacy::getInstance('Positions','JTheFactoryModel');
        $fields=$model->getFieldsForPosition($template_file,$position);       
        $result="";

        $fieldObj= JTable::getInstance('FieldsTable','JTheFactory');
        JTheFactoryHelper::modelIncludePath('fields');
        $fieldsmodel= JModelLegacy::getInstance('Fields','JTheFactoryModel');
        
        foreach($fields as $field)
            if (isset($item[$field->db_name])&&$page==$field->page)
            {
                $fieldObj->bind($field);
                if ($catfield && $fieldObj->categoryfilter && !$fieldsmodel->hasAssignedCat($fieldObj,$item->$catfield))
                    continue;
                    
                $ftype= CustomFieldsFactory::getFieldType($field->ftype);
                $field_label=$field->name;

                $field_html=$ftype->getTemplateHTML($fieldObj,$item[$field->db_name]);
                
                $result.="<div id='{$field->db_name}'><label class='custom_field'>{$field_label}</label>:&nbsp;{$field_html}</div>";
            }
        return $result;
    }
Example #15
0
 function setDefaults()
 {
     $this->search = 0;
     $this->compulsory = 0;
     $this->categoryfilter = 0;
     $this->status = 1;
     $this->validate_type = null;
     $types = CustomFieldsFactory::getFieldTypesList();
     $this->ftype = $types[0];
     $pages = CustomFieldsFactory::getPagesList();
     $this->page = $pages[0];
 }
Example #16
0
    function display($tpl=null) {

        $database = JFactory::getDBO();
        $my = JFactory::getUser();
        $cfg = BidsHelperTools::getConfig();

        JHTML::_('behavior.modal');
        JHTML::_('behavior.tooltip');

        JHTML::script(JURI::root().'components/com_bids/js/ratings.js');
        JHTML::script( JURI::root().'components/com_bids/js/startup.js' );

        $model = $this->getModel();
        $profile = $model->get('profile');

        $lists['balance'] = $model->getBalance();

        $lists["ratings"] = $model->getRatings(10);
        $lists["messages"]["received"] = $model->getMessages();

        if ($cfg->bid_opt_allow_user_settings && $profile->isSeller) {

            $p = JTable::getInstance('bidusersettings');
            $p->load($my->id);
            $settings = $p->settings;

            $lists['user_settings'] = array();

            if($cfg->bid_opt_enable_hour) {
                //convert end time to GMT
                try {
                    $endTime = @$settings["end_hour"].':'.@$settings["end_minute"];
                    @list($settings["end_hour"],$settings["end_minute"]) = explode(':',JHTML::date($endTime,'H:i'));
                } catch(Exception $e) {
                    if(JDEBUG) {
                        //JError::raiseWarning(1,$e->getMessage());
                    }
                }
                //end time is GMT, convert it to locale

                $lists['user_settings']['end_hour'] = '<input type="text" name="end_hour" class="inputbox" value="'.@$settings['end_hour'].'" style="width:20px;" />';
                $lists['user_settings']['end_minute'] = '<input type="text" name="end_minute" class="inputbox" value="'.@$settings['end_minute'].'" style="width:20px;" />';
            }
            $lists['user_settings']['payment_info'] = '<input style="width: 300px;" type="text" name="payment_info"
            class="inputbox"
            value="'.@$settings['payment_info'].'" />';
            $lists['user_settings']['shipment_info'] = '<input style="width: 300px;" type="text" name="shipment_info" class="inputbox" value="'.@$settings['shipment_info'].'" />';
            $lists['user_settings']['show_reserve'] = JHTML::_('select.booleanlist','show_reserve',null,@$settings['show_reserve'],'COM_BIDS_SHOW','COM_BIDS_HIDE');
            $lists['user_settings']['auto_accept_bin'] = JHTML::_('select.booleanlist','auto_accept_bin',null,@$settings['auto_accept_bin']);
            $lists['user_settings']['bid_counts'] = JHTML::_('select.booleanlist','bid_counts',null,@$settings['bid_counts'],'COM_BIDS_SHOW','COM_BIDS_HIDE');
            $lists['user_settings']['max_price'] = JHTML::_('select.booleanlist','max_price',null,@$settings['max_price'],'COM_BIDS_SHOW','COM_BIDS_HIDE');

            $fi = isset($settings['auction_type']) ? $settings['auction_type'] : null;

            $opts = array();
            $opts[] = JHTML::_('select.option', '', JText::_('COM_BIDS_PICK_TYPE_OF_AUCTION'));
            $opts[] = JHTML::_('select.option', AUCTION_TYPE_PUBLIC, JText::_('COM_BIDS_PUBLIC_LABEL'));
            if ($cfg->bid_opt_global_enable_private)
                $opts[] = JHTML::_('select.option', AUCTION_TYPE_PRIVATE, JText::_('COM_BIDS_PRIVATE_LABEL'));
            if ($cfg->bid_opt_enable_bin_only)
                $opts[] = JHTML::_('select.option', AUCTION_TYPE_BIN_ONLY, JText::_('COM_BIDS_BIN_ONLY_LABEL'));

            $lists['user_settings']['auction_type'] = JHTML::_('select.genericlist', $opts, 'auction_type', 'class="inputbox" alt="auction_type"', 'value', 'text', $fi);

            $fi = isset($settings['currency']) ? $settings['currency'] : null;

            $query = "SELECT name AS value, name AS text FROM #__bid_currency ORDER BY id";
            $opts = null;
            $database->setQuery($query);
            $opts = $database->loadObjectList();
            $defaultOpt = JHtml::_('select.option','',JText::_('COM_BIDS_SELECT_CURRENCY'));
            array_unshift($opts,$defaultOpt);
            $lists["user_settings"]['currency'] = JHTML::_('select.genericlist', $opts, 'currency',
                'class="inputbox" onchange="bidsRefreshCurrency(this.value)"', 'value', 'text', $fi);

            $lists['user_settings']['shipment_price'] = '<input type="text" name="shipment_price" class="inputbox"
            style="text-align: right; width: 80px;" value="' . BidsHelperAuction::formatPrice
            (@$settings['shipment_price']) . '" />&nbsp;&nbsp;<span class="bidsRefreshCurrency">'.$fi.'</span>';
        }

        $lists["links"]=array(
          "upload_funds"=>BidsHelperRoute::getAddFundsRoute(),
          "payment_history"=>BidsHelperRoute::getPaymentsHistoryRoute()
        );

        $lists['fbLikeButton'] = JHTML::_('userProfile.fbLikeButton', $profile);
        $lists['linkEditProfile'] = JHTML::_('userprofile.linkEditProfile');
        $lists['linkUserRatings'] = JHTML::_('userprofile.linkUserRatings',$profile);

        $profile->paypalemail = BidsHelperTools::cloack_email($profile->paypalemail);

        $fields = CustomFieldsFactory::getFieldsList("user_profile");

        if($cfg->terms_and_conditions) {
            $lists['linktc'] = JRoute::_('index.php?option=com_bids&task=terms_and_conditions&tmpl=component');
        }


        $this->assign("user", $profile);
        $this->assign("lists", $lists);
        $this->assign("fields", $fields);
        $this->assign('return', JRequest::getCmd("return"));

        return parent::display($tpl);
    }
Example #17
0
 function display($tpl = null)
 {
     $lang = JFactory::getLanguage();
     $lang->load('com_bids', JPATH_SITE);
     $model = $this->getModel('auction');
     $auction = $model->get('auction');
     $bidCfg = BidsHelperTools::getConfig();
     $lists = array();
     $lists['title'] = JHTML::_('editauction.inputTitle', $auction, 1);
     $lists['cats'] = JHTML::_('editauction.selectCategory', $auction, 1);
     //$lists['cats']    = JHTML::_('factorycategory.select','cat','',$auction->cat,false,false,true);
     $lists['published'] = JHTML::_('editauction.selectPublished', $auction, 1);
     $lists['tags'] = JHTML::_('editauction.inputTags', $auction, 1);
     $lists['shortDescription'] = JHTML::_('editauction.inputShortDescription', $auction, 1);
     $lists['description'] = JHTML::_('editauction.inputDescription', $auction, 1);
     $lists['auctiontype'] = JHTML::_('editauction.selectAuctionType', $auction, 1);
     $lists['automatic'] = JHTML::_('editauction.inputAutomatic', $auction, 1);
     $lists['binType'] = JHTML::_('editauction.selectBINType', $auction, 1);
     $lists['binPrice'] = JHTML::_('editauction.inputBINPrice', $auction, 1);
     $lists['autoAcceptBIN'] = JHTML::_('editauction.selectAutoAcceptBIN', $auction, 1);
     $lists['quantity'] = JHTML::_('editauction.inputQuantity', $auction, 1);
     $lists['enableSuggestions'] = JHTML::_('editAuction.selectEnableSuggestions', $auction, 1);
     $lists['minNumberSuggestions'] = JHTML::_('editAuction.inputMinNumberSuggestions', $auction, 1);
     $lists['currency'] = JHTML::_('editauction.selectCurrency', $auction, 1);
     $lists['initialPrice'] = JHTML::_('editauction.inputInitialPrice', $auction, 1);
     $lists['showMaxPrice'] = JHTML::_('editauction.selectShowMaxPrice', $auction, 1);
     $lists['showNumberBids'] = JHTML::_('editauction.selectShowNumberBids', $auction, 1);
     $lists['reservePrice'] = JHTML::_('editauction.inputReservePrice', $auction, 1);
     $lists['showReservePrice'] = JHTML::_('editauction.selectShowReservePrice', $auction, 1);
     $lists['minIncrease'] = JHTML::_('editauction.inputMinIncrease', $auction, 1);
     $lists['shippingPrice'] = JHTML::_('editAuction.inputShipmentPrice', $auction, 1);
     $lists['uploadImages'] = JHTML::_('editauction.uploadImages', $auction, 1);
     $lists['paymentInfo'] = JHTML::_('editauction.textPaymentInfo', $auction, 1);
     $lists['shipmentInfo'] = JHTML::_('editauction.textShipmentInfo', $auction, 1);
     //$lists[''] = JHTML::_('editauction.',$auction);
     $lists['currentLocalTime_field'] = JHTML::_('editAuction.currentLocalTime', $auction);
     $lists['startDate_field'] = JHTML::_('editAuction.editStartDate', $auction, 1);
     $lists['endDate_field'] = JHTML::_('editAuction.editEndDate', $auction, 1);
     $lists['editFormTitle'] = JHTML::_('editAuction.formTitle', $auction);
     $auction->links = JHTML::_('auctiondetails.createLinks', $auction);
     $fields = CustomFieldsFactory::getFieldsList("auctions");
     $fields_html = JHtml::_('listauctions.displayfieldshtml', $auction, $fields);
     $custom_fields_with_cat = $model->getNrFieldsWithFilters();
     $this->assign("custom_fields", $fields);
     $this->assign("custom_fields_html", $fields_html);
     $this->assign("custom_fields_with_cat", $custom_fields_with_cat ? 1 : 0);
     $this->assign('lists', $lists);
     $this->assign('auction', $auction);
     $this->assign('bidCfg', $bidCfg);
     JHtml::_('behavior.framework');
     JHtml::_('behavior.tooltip');
     JHtml::_('behavior.calendar');
     JHTML::_('behavior.formvalidation');
     JHtml::script(JURI::root() . 'components/com_bids/js/auctions.js');
     JHtml::script(JURI::root() . 'components/com_bids/js/date.js');
     JHtml::script(JURI::root() . 'components/com_bids/js/multifile.js');
     JHtml::script(JURI::root() . 'components/com_bids/js/auction_edit.js');
     JHtml::script(JURI::root() . 'components/com_bids/js/jquery/jquery.js');
     JHtml::script(JURI::root() . 'components/com_bids/js/jquery/jquery.noconflict.js');
     JHTML::script(JURI::root() . 'components/com_bids/js/jquery/clock/jquery.clock.js');
     JHtml::script(JURI::base() . 'index.php?option=com_bids&task=jsgen&view=editauction&format=raw');
     JHtml::stylesheet(JURI::root() . 'components/com_bids/templates/default/bid_template.css');
     parent::display($tpl);
 }
Example #18
0
 function getFieldtypeParams()
 {
     $format = JRequest::getWord('format', 'html');
     $fieldid = JRequest::getInt('fieldid');
     $fieldtype = JRequest::getWord('ftype');
     $fieldtypeobj = CustomFieldsFactory::getFieldType($fieldtype);
     $paramsvalues = '';
     $field = null;
     if ($fieldid) {
         $field = JTable::getInstance('FieldsTable', 'JTheFactory');
         if (!$field->load($fieldid)) {
             $view = $this->getView('edit', $format);
             $view->assignRef('message', JText::_("FACTORY_FIELD_DOES_NOT_EXIST_ID") . $fieldid);
             $view->display('error');
             return;
         }
         $paramsvalues = $field->params;
     }
     $view = $this->getView('edit', $format);
     $view->assignRef('field', $field);
     $view->assignRef('paramvalues', $paramsvalues);
     $view->assignRef('field_type', $fieldtypeobj);
     $view->display('update_params');
 }