Пример #1
0
 private static function seek($id = false)
 {
     if (empty($_POST['call'])) {
         echo 'NONE';
     }
     $seekStr = $_POST['call'];
     if (!empty($id)) {
         $rsnum = CRUD::dataFetch('gallery', array('id' => $id), array('related'));
         if (!empty($rsnum)) {
             list($nowRow) = CRUD::$data;
             if (!empty($nowRow['related'])) {
                 $relatedArray = json_decode($nowRow['related'], true);
                 $seekFilter = "id NOT IN('" . implode("','", $relatedArray) . "','" . $id . "')";
                 $sk = array('status' => '1', 'langtag' => CORE::$langtag, 'subject' => '%' . $seekStr . '%', 'custom' => $seekFilter);
             } else {
                 $sk = array('status' => '1', 'langtag' => CORE::$langtag, 'subject' => '%' . $seekStr . '%', 'id' => "!{$id}");
             }
         }
     }
     if (empty($sk) || !is_array($sk)) {
         $sk = array('status' => '1', 'langtag' => CORE::$langtag, 'subject' => '%' . $seekStr . '%');
     }
     $rsnum = CRUD::dataFetch('gallery', $sk);
     if (!empty($rsnum)) {
         $dataRow = CRUD::$data;
         foreach ($dataRow as $key => $row) {
             foreach ($row as $field => $var) {
                 $output[$key][$field] = rawurlencode($var);
             }
             IMAGES::load('gallery', $row["id"]);
             list($image) = IMAGES::$data;
             $output[$key]['image'] = '<img src="' . $image['path'] . '" style="width: 100px;">';
             $output[$key]['link'] = GALLERY::dataLink($row['parent'], $row);
         }
         if (is_array($output)) {
             echo json_encode($output);
         }
     } else {
         echo 'NONE';
     }
 }
Пример #2
0
 public static function related($related = false)
 {
     if (empty($related)) {
         return false;
     }
     $relatedArray = json_decode($related, true);
     $rsnum = CRUD::dataFetch('gallery', array('id' => $relatedArray, 'status' => '1', 'langtag' => CORE::$langtag));
     if (!empty($rsnum)) {
         VIEW::newBlock("TAG_RELATED_BLOCK");
         $dataRow = CRUD::$data;
         foreach ($dataRow as $key => $row) {
             VIEW::newBlock("TAG_RELATED_LIST");
             IMAGES::load('gallery', $row["id"]);
             list($image) = IMAGES::$data;
             VIEW::assign(array("VALUE_ID" => $row['id'], "VALUE_SUBJECT" => $row['subject'], "VALUE_IMAGE" => $image['path'], "VALUE_ALT" => $image['alt'], "VALUE_TITLE" => $image['title'], "VALUE_LINK" => GALLERY::dataLink($row['parent'], $row)));
         }
     }
 }