예제 #1
0
 function init_avs()
 {
     //now get an av, if it exists
     $fh = new Feature_Helper();
     $id = $this->get_value('id');
     $av_ids = null;
     $results_array = $fh->get_avs_associated_with_feature($id);
     if (!empty($results_array)) {
         foreach ($results_array as $r) {
             $tmp = $r->get_value('av_id');
             if (is_array($tmp)) {
                 $av_ids = $tmp;
             } else {
                 if ($tmp != "none") {
                     $av_ids = array(0 => $tmp);
                 } else {
                     $av_ids = array(0 => "none");
                 }
             }
         }
     } else {
         $av_ids = array(0 => "none");
     }
     $this->av_ids = $av_ids;
     $av_html = array();
     $av_img_url = array();
     $av_img_alt = array();
     $av_thumbnail_urls = array();
     $av_img_ids = array();
     $av_types = array();
     foreach ($av_ids as $id) {
         if ($id != "none") {
             $av_info = $fh->get_av_info($id, $this->width, $this->height);
             $av_html[] = htmlspecialchars($av_info['av_html'], ENT_QUOTES);
             $av_img_url[] = $av_info['av_img_url'];
             $av_img_alt[] = $av_info['av_img_alt'];
             if ($av_info['av_img_id'] != "none") {
                 $av_thumbnail_urls[] = reason_get_image_url($av_info['av_img_id'], 'thumbnail');
                 $av_img_ids[] = $av_info['av_img_id'];
             } else {
                 $av_thumbnail_urls[] = $av_info['av_img_url'];
                 $av_img_ids[] = "none";
             }
             $av_types[] = $av_info['type'];
             //pray($av_info);
         } else {
             $av_img_url[] = "none";
             $av_img_alt[] = "";
             $av_thumbnail_urls[] = "none";
             $av_img_ids[] = "none";
             $av_types[] = "none";
         }
     }
     $this->av_image_urls = $av_img_url;
     $this->av_image_alts = $av_img_alt;
     $this->av_thumbnail_urls = $av_thumbnail_urls;
     $this->av_img_ids = $av_img_ids;
     $this->av_types = $av_types;
 }