function set($view_data,$view_params,$current_feature_id,&$head_items) { //call Mother parent::set($view_data,$view_params,$current_feature_id,$head_items); //Make sure all view data have default values //if they haven't been set foreach($view_data as $id=>$data) { if(!isset($data['id'])){ $view_data[$id]['id']=0; } if(!isset($data['destination_url'])){ $view_data[$id]['destination_url']=null; } if(!isset($data['active'])){ $view_data[$id]['active']="inactive"; } if(!isset($data['bg_color'])){ $view_data[$id]['bg_color']="ffffff"; } if(!isset($data['title'])){ $view_data[$id]['title']="";} if(!isset($data['text'])){ $view_data[$id]['text']="";} if(!isset($data['w'])){ $view_data[$id]['w']=$this->default_width;} if(!isset($data['h'])){ $view_data[$id]['h']=$this->default_height;} if(!isset($data['show_text'])){ $view_data[$id]['show_text']=0;} if(!isset($data['current_image_index'])){ $view_data[$id]['current_image_index']=0;} if(!isset($data['current_object_type'])){ $view_data[$id]['current_object_type']="img";} if(!isset($data['feature_image_url'])){ $view_data[$id]['feature_image_url']=array("none");} if(!isset($data['feature_image_alt'])){ $view_data[$id]['feature_image_alt']=array("");} if(!isset($data['feature_av_html'])){ $view_data[$id]['feature_av_html']=array("none");} if(!isset($data['feature_av_img_url'])){ $view_data[$id]['feature_av_img_url']=array("none");} if(!isset($data['feature_av_img_alt'])){ $view_data[$id]['feature_av_img_alt']=array("");} if ($view_data[$id]['current_object_type'] == 'av') $this->has_av = true; } $this->_view_data=$view_data; $width=$this->_view_params['width']; $height=$this->_view_params['height']; if($head_items != null) { $head_items->add_javascript(JQUERY_URL, true); if ($this->has_av) { $head_items->add_javascript(REASON_PACKAGE_HTTP_BASE_PATH."nyroModal/js/jquery.nyroModal-1.6.2.min.js"); } $head_items->add_javascript(REASON_HTTP_BASE_PATH . 'js/feature.js'); $head_items->add_stylesheet(REASON_HTTP_BASE_PATH . 'css/features/feature_responsive.css'); $head_items->add_head_item("style",array("type"=>"text/css")," .featuresModule { max-width: ".$width."px; } .features { padding-bottom:" . round($height/$width*100, 5) . "%; } ",false); } }// end set function
function set($view_data, $view_params, $current_feature_id, &$head_items) { //call Mother parent::set($view_data, $view_params, $current_feature_id, $head_items); //Make sure all view data have default values //if they haven't been set foreach ($view_data as $id => $data) { if (!isset($data['id'])) { $view_data[$id]['id'] = 0; } if (!isset($data['destination_url'])) { $view_data[$id]['destination_url'] = null; } if (!isset($data['active'])) { $view_data[$id]['active'] = "inactive"; } if (!isset($data['bg_color'])) { $view_data[$id]['bg_color'] = "ffffff"; } if (!isset($data['title'])) { $view_data[$id]['title'] = ""; } if (!isset($data['text'])) { $view_data[$id]['text'] = ""; } if (!isset($data['w'])) { $view_data[$id]['w'] = $this->default_width; } if (!isset($data['h'])) { $view_data[$id]['h'] = $this->default_height; } if (!isset($data['show_text'])) { $view_data[$id]['show_text'] = 0; } if (!isset($data['current_image_index'])) { $view_data[$id]['current_image_index'] = 0; } if (!isset($data['current_object_type'])) { $view_data[$id]['current_object_type'] = "img"; } if (!isset($data['feature_image_url'])) { $view_data[$id]['feature_image_url'] = array("none"); } if (!isset($data['feature_image_alt'])) { $view_data[$id]['feature_image_alt'] = array(""); } if (!isset($data['feature_av_html'])) { $view_data[$id]['feature_av_html'] = array("none"); } if (!isset($data['feature_av_img_url'])) { $view_data[$id]['feature_av_img_url'] = array("none"); } if (!isset($data['feature_av_img_alt'])) { $view_data[$id]['feature_av_img_alt'] = array(""); } } $this->_view_data = $view_data; $width = $this->_view_params['width']; $height = $this->_view_params['height']; if ($head_items != null) { $head_items->add_javascript(REASON_PACKAGE_HTTP_BASE_PATH . "nyroModal-1.6.2/js/jquery.nyroModal-1.6.2.min.js"); $head_items->add_javascript(REASON_HTTP_BASE_PATH . 'js/feature.js'); $head_items->add_stylesheet(REASON_HTTP_BASE_PATH . 'css/features/feature.css'); $head_items->add_head_item("style", array("type" => "text/css"), "\n\t\t\t.features, .features .sizable { height:" . $height . "px; }\n\t\t\t.features .sizable { width:" . $width . "px; }\n\t\t\t", false); } }