Пример #1
0
 /**
  * @see SampleInterface::get_sub_folder()
  * @param integer $folder_id Folder-ID
  * @param integer $gid 
  * @return string Sub-Folder-Path
  */
 public function get_sub_folder($folder_id, $gid)
 {
     if ($this->sample_id and $this->sample) {
         if (is_numeric($folder_id) and is_numeric($gid)) {
             $sample_folder_id = SampleFolder::get_folder_by_sample_id($this->sample_id);
             if ($folder_id == $sample_folder_id) {
                 $folder = Folder::get_instance($folder_id);
                 $sample_template = new SampleTemplate($this->sample->get_template_id());
                 $attribute_array = $sample_template->get_gid_attributes($gid);
                 if ($attribute_array['folder']) {
                     $folder_name = strtolower(trim($attribute_array['folder']));
                     $folder_name = str_replace(" ", "-", $folder_name);
                     $folder_path = new Path($folder->get_path());
                     $folder_path->add_element($folder_name);
                     return Folder::get_folder_by_path($folder_path->get_path_string());
                 } else {
                     return null;
                 }
             } else {
                 return null;
             }
         } else {
             return null;
         }
     } else {
         return null;
     }
 }
Пример #2
0
 /**
  * @see SampleItemInterface::is_classified()
  * @return bool
  */
 public function is_classified()
 {
     if ($this->sample and is_numeric($this->gid)) {
         $sample_template = new SampleTemplate($this->sample->get_template_id());
         if (is_array($attribute_array = $sample_template->get_gid_attributes($this->gid))) {
             if ($attribute_array['class']) {
                 if ($attribute_array['classify'] == "force") {
                     return $attribute_array['class'];
                 } else {
                     return false;
                 }
             } else {
                 return false;
             }
         } else {
             return false;
         }
     } else {
         return false;
     }
 }