Example #1
0
 public static function FetchFromAssoc($assoc)
 {
     global $link_to_service_images;
     global $link_to_report_files;
     $ob = new self();
     if (ArrayElemIsValidStr($assoc, 'id')) {
         $ob->id = $assoc['id'];
     }
     if (ArrayElemIsValidStr($assoc, 'author_id')) {
         $ob->author_id = $assoc['author_id'];
     }
     if (ArrayElemIsValidStr($assoc, 'recipient_id')) {
         $ob->recipient_id = $assoc['recipient_id'];
     }
     if (ArrayElemIsValidStr($assoc, 'name')) {
         $ob->name = $assoc['name'];
     }
     if (ArrayElemIsValidStr($assoc, 'text_block')) {
         $ob->text_block = $assoc['text_block'];
     }
     if (isset($assoc['recipient_ids'])) {
         if (is_string($assoc['recipient_ids'])) {
             $tmp = [];
             if (ArrayElemIsValidStr($assoc, 'recipient_ids')) {
                 $tmp = json_decode($assoc['recipient_ids']);
             }
             $ob->recipient_ids = $tmp;
         } else {
             $ob->recipient_ids = $assoc['recipient_ids'];
         }
     }
     try {
         if (ArrayElemIsValidStr($assoc, 'creating_date')) {
             $ob->creating_date = strtotime($assoc['creating_date']);
         }
     } catch (Exception $e) {
         $ob->creating_date = $assoc['creating_date'];
     }
     if (ArrayElemIsValidStr($assoc, 'id')) {
         $ob->path_to_file = PathToFile($link_to_report_files . $ob->id, 'file', $link_to_service_images . 'Logo.png');
     }
     return $ob;
 }
Example #2
0
function PathToImage($start_path, $image_name, $default_ans = '#default#', $available = array('bmp', 'gif', 'jpg', 'jpe', 'png', 'jpeg', 'svg'), $lang = '')
{
    if ($lang === '') {
        $lang = GetLanguage();
    }
    return PathToFile($start_path, $image_name, $default_ans, $available, $lang);
}