images = array( 'medium' => array( 'width' => 142, 'height' => 192, 'quality' => 98, 'web_location' => '/images/designers/' ), 'vertical' => array( 'width' => 100, 'height' => 425, 'quality' => 98, 'web_location' => '/images/designers/vertical_name/' ) ); $this->img_tag_attr = array(); // ----------------------------------------------------- // set path based on unix or windows foreach($this->images as $image_size=>$image_info) { $this->images[$image_size]['path'] = Config::$path_to_www; $this->images[$image_size]['path'] .= (Config::$location == 'remote') ? $this->images[$image_size]['web_location'] : str_replace('/', '\\', $this->images[$image_size]['web_location']); // ----------------------------------------------------- $this->img_tag_attr[$image_size] = 'width="'.$image_info['width'].'" height="'.$image_info['height'].'"'; } $this->dbTableName = Config::$db_tables['vendor_designers']; } function generate_select($arg_array) //($Forms, $name, $RS, $onchange='', $top_option, $selected='', $css) { foreach($arg_array as $arg=>$val) { $$arg = $val; //echo '
'.$arg.'=>'.$val; } $options = array(); while($record = $RS->FetchRow()) { $options[$record['id']] = $record['name']; } return($Forms->generate_select_formfield($name, $options, $top_option, $selected, $onchange, $css)); } function get_RecordSet($title='', $status_web='all', $where_add='', $order_by='', $limit='', $status_store='all') { $title .= ' Designers::get_RecordSet'; // build query and pass to $Database::get_RecordSet $select = "*"; $from = $this->dbTableName; $where = ""; $where_started = FALSE; switch($status_web) { case '': break; // defaults to all case 'all': break; case 'active': if($where_started) { $where .= " AND "; } $where .= "status_web='$status_web'"; $where_started = TRUE; break; case 'inactive': if($where_started) { $where .= " AND "; } $where .= "status_web='$status_web'"; $where_started = TRUE; break; default: echo 'invalid '.$this->table_name.' status_web passed to Designers::get_RecordSet'; exit(); } switch($status_store) { case '': break; // defaults to all case 'all': break; case 'active': if($where_started) { $where .= " AND "; } $where .= "status_store='$status_store'"; $where_started = TRUE; break; case 'inactive': if($where_started) { $where .= " AND "; } $where .= "status_store='$status_store'"; $where_started = TRUE; break; default: echo 'invalid '.$this->table_name.' status_store passed to Designers::get_RecordSet'; exit(); } if($where_add != '') { $where .= ($where_started) ? " AND " : ""; $where .= $where_add; } return(Database::get_RecordSet($select, $from, $where, $order_by, $limit, $title)); } function num_items($designer_id) { if(!$RS = $this->get_items_RecordSet($designer_id)) { return(0); } else { return($RS->RecordCount()); } } function has_live_items($designer_id, $Items, $Sizes) { if(!$RS = $this->get_items_RecordSet($designer_id, 'active')) { return(FALSE); } while($record = $RS->FetchRow()) { $Item = new Item($record['id']); if($Item->is_live_web($Items)) { return(TRUE); } } return(FALSE); } function num_live_items($designer_id) { if(!$RS = $this->get_items_RecordSet($designer_id, 'active')) { return(0); } $num = 0; while($record = $RS->FetchRow()) { $Item = new Item($record['id']); if($Item->is_live_web($Items)) { ++$num; } } return($num); } function is_featured($designer_id) { return(Database::ado_get_record_count("SELECT * FROM ".Config::$db_tables['vendor_designers_featured_images']." WHERE designer_id='$designer_id'", "Designers::is_featured") > 0); } function get_items_RecordSet($designer_id, $status_web='all', $order_by='') { $query = "SELECT * FROM ".Config::$db_tables['inventory_items']." WHERE designer_id='$designer_id'"; if($status_web != 'all') { $query .= " AND status_web='$status_web'"; } if($order_by != '') { $query .= " ORDER BY $order_by"; } return(Database::ado_execute_query($query, 'Designer::get_items_RecordSet')); } function get_name($designer_id, $referer='') { if($referer == '') { $referer = $_SERVER['SCRIPT_NAME']; } return(Database::get_field_for_object('name', $this, $designer_id, $referer)); } } ?>