Esempio n. 1
0
 /**
  * @return Model_Kwalbum_Item
  */
 public function getNextItem()
 {
     $where_query = Model_Kwalbum_Item::get_where_query();
     if (!$where_query) {
         $where_query = ' WHERE ';
     } else {
         $where_query .= ' AND ';
     }
     $sort_field = Model_Kwalbum_Item::$_sort_field;
     $sort_direction = Model_Kwalbum_Item::$_sort_direction;
     $gtlt = Model_Kwalbum_Item::$_gtlt == '<' ? '>' : '<';
     $query = "SELECT id\n\t\t\tFROM kwalbum_items {$where_query}\n\t\t\t({$sort_field} {$gtlt} :sort_value\n\t\t\t\tOR ({$sort_field} = :sort_value AND id {$gtlt} :id))\n\t\t\tORDER BY {$sort_field} {$sort_direction}, id {$sort_direction}\n\t\t\tLIMIT 1";
     $result = DB::query(Database::SELECT, $query)->param(':sort_value', $this->getSortValue())->param(':id', $this->id)->execute();
     return Model::factory('kwalbum_item')->load((int) $result[0]['id']);
 }
Esempio n. 2
0
 public function action_GetMapItems()
 {
     $zoom = (int) $_GET["z"];
     if ($zoom == 17) {
         $limit = 20;
     } else {
         $limit = 10;
     }
     $where = Model_Kwalbum_Item::get_where_query();
     if (!$where) {
         $where = ' WHERE 1=1 ';
     }
     $data = array();
     Model_Kwalbum_Item::getMarkers((double) $_GET["l"], (double) $_GET["r"], (double) $_GET["t"], (double) $_GET["b"], $where, $data, $limit, 1);
     echo "point\ttype\ttitle\tdescription";
     foreach ($data as $d) {
         echo "\n{$d['lon']},{$d['lat']}\t";
         if ($d['group']) {
             echo "g\t{$d['count']}\t{$zoom}";
         } else {
             echo "i\t{$d['id']}\t{$d['date']}";
         }
     }
 }