Exemplo n.º 1
0
 /**
  * Метод добавления события в блок событий.
  * 
  * При этом дата самого событийного блока определяется датой первого добавленного в него события.
  * Все остальные собыия должны иметь ту же дату.
  * 
  * @param NewsEvent $event
  */
 public function addEvent(NewsEvent $event)
 {
     if (empty($this->events)) {
         $this->blockDate = $event->getBlockDate();
         $this->pickerDate = DatesTools::inst()->uts2dateInCurTZ($event->getNewsEventUtc(), DF_JS_DATEPICKER);
     } else {
         check_condition($this->blockDate == $event->getBlockDate(), "Новость на дату [{$event->getBlockDate()}] не может быть добавлена в блок на дату [{$this->blockDate}]");
     }
     $this->events[] = $event;
 }
Exemplo n.º 2
0
$per_page = 1;
// 3. total record count ($total_count)
// if($new->visible == 1){
$total_count = NewsEvent::count_all();
// }else{
//   $total_count = NewsEvent::count_all_visible();
// }
// Find all photos
// use pagination instead
$pagination = new Pagination($page, $per_page, $total_count);
// Instead of finding all records, just find the records
// for this page
$sql = "SELECT * FROM news_events ORDER BY `id` DESC ";
$sql .= "LIMIT {$per_page} ";
$sql .= "OFFSET {$pagination->offset()}";
$newsEvents = NewsEvent::find_by_sql($sql);
// Need to add ?page=$page to all links we want to
// maintain the current page (or store $page in $session)
$counter = 1;
?>


     <ul>
      <?php 
foreach ($newsEvents as $item) {
    switch ($item->iType) {
        case 1:
            $icon = '<i class="icon-user"></i>';
            break;
        case 2:
            $icon = '<i class="icon-user"></i>';
Exemplo n.º 3
0
 protected function doCreateObject(array $array)
 {
     $object = new NewsEvent();
     $object->loadFromArray($array);
     return $object;
 }
Exemplo n.º 4
0
$total_count = NewsEvent::count_all();
// Find all photos
// use pagination instead
$pagination = new Pagination($page, $per_page, $total_count);
// Instead of finding all records, just find the records
if (!empty($newsEvents)) {
    // for this page
    $sql = "SELECT * FROM news_events \n                  WHERE id != {$get_id}\n                  AND visible = 1\n                  AND verified_by !='' \n                  ORDER BY id DESC  ";
    $sql .= "LIMIT {$per_page} ";
    $sql .= "OFFSET {$pagination->offset()}";
    $news_query = NewsEvent::find_by_sql($sql);
} else {
    $sql = "SELECT * FROM news_events \n                  WHERE visible = 1\n                  AND verified_by !='' \n                  ORDER BY id DESC  ";
    $sql .= "LIMIT {$per_page} ";
    $sql .= "OFFSET {$pagination->offset()}";
    $news_query = NewsEvent::find_by_sql($sql);
}
// Need to add ?page=$page to all links we want to
// maintain the current page (or store $page in $session)
$counter = 1;
foreach ($news_query as $itemR) {
    ?>

   
      <ul>
        <li style ="border">
      <i class="icon-hand-right"></i> 
    <a href="all_news.php?id=<?php 
    echo customEncrypt($itemR->id);
    ?>
 "> <?php