Ejemplo n.º 1
0
 function home_get()
 {
     $timeStamp = $this->get('timestamp');
     if (!isValidTimeStamp($timeStamp)) {
         $this->response(array('error' => 'Invalid timestamp'), 400);
     } else {
         $this->load->model('Banner_model', 'banner');
         $this->load->model('Brand_model', 'brand');
         $result = array();
         $slider1 = $this->banner->get_home_slider(1, TRUE);
         //$slider2=$this->banner->get_home_slider(2,TRUE);
         $noOfItem = $this->siteconfig->get_value_by_name('MOBILE_APP_HOME_PAGE_SLIDER_ITEM_NO');
         $newArrivalsData = $this->product->get_recent($noOfItem, TRUE);
         //pre($newArrivalsData);die;
         $result['slider1'] = $slider1;
         //$result['slider2']=$slider2;
         $result['category_menu'] = $this->get_main_menu();
         $result['best_sellling_item'] = $newArrivalsData;
         $result['new_arrivals'] = $newArrivalsData;
         $result['featured_products'] = $newArrivalsData;
         $result['brand'] = $this->brand->get_all(TRUE);
         //$result['site_product_image_url']=$this->config->item('ProductURL');
         success_response_after_post_get($result);
     }
 }
Ejemplo n.º 2
0
 /**
  * Converts a date string into RFC3339 format for google calendar api.
  * This is used for start/end dates for the creation/modification of events.
  *
  * If $allDay and $isEnd are true, a day is added onto the date
  * since the Google calendar thinks an all day event that spans
  * multiple days ends on the day before rather than consuming the day it
  * ends on.
  *
  * Example: For an all day event that starts January 1st and ends January 3rd,
  * Google will end the event on the 2nd since the idea here is that the event
  * is 'till' the 3rd.
  *
  * @param string $dateStr
  * @param bool   $allDay
  * @param bool   $isEnd
  *
  * @return string
  */
 function strToRfc3339($dateStr, $allDay = false, $isEnd = false)
 {
     $date = new \DateTime();
     /*
      * Check if the date is already in unix time or not
      */
     if (isValidTimeStamp($dateStr)) {
         $date->setTimestamp($dateStr);
     } else {
         $date->setTimestamp(strtotime($dateStr));
     }
     /*
      * If the event is all day, google only accepts Y-m-d formats instead
      * of RFC3339
      */
     if ($allDay) {
         if ($isEnd) {
             $date->add(new \DateInterval('P1D'));
         }
         return $date->format('Y-m-d');
     } else {
         return $date->format(\DateTime::RFC3339);
     }
 }
Ejemplo n.º 3
0
function buildPAPIItem($itemArray, $file)
{
    $myPart = new Part(array('content' => '', 'directives' => array('mimeHint' => 'text', 'encoding' => 'utf-8')));
    //var_dump($itemArray['pubDate']);
    if (empty($itemArray['pubDate'])) {
        $itemArray['pubDate'] = date('r', mktime());
    }
    if (isValidTimeStamp($itemArray['pubDate'])) {
        $itemArray['pubDate'] = date('r', $itemArray['pubDate']);
    }
    $myDoc = new Document(array('uri' => $itemArray['outGoingLink'], 'parts' => $myPart, 'metas' => array('file_name' => $file, 'item_title' => !empty($itemArray['title']) ? $itemArray['title'] : '', 'item_desc' => !empty($itemArray['content']) ? $itemArray['content'] : '', 'item_address' => !empty($itemArray['address']) ? $itemArray['address'] : '', 'item_geolocation' => !empty($itemArray['geolocation']) ? $itemArray['geolocation'] : '', 'item_latitude' => !empty($itemArray['latitude']) ? $itemArray['latitude'] : '', 'item_longitude' => !empty($itemArray['longitude']) ? $itemArray['longitude'] : '', 'uri' => !empty($itemArray['outGoingLink']) ? $itemArray['outGoingLink'] : mktime(), 'publicurl' => !empty($itemArray['outGoingLink']) ? $itemArray['outGoingLink'] : '', 'image_enclosure' => !empty($itemArray['thumb']) ? $itemArray['thumb'] : '', 'item_yakcat' => !empty($itemArray['yakCats']) ? $itemArray['yakCats'] : '', 'item_freetag' => !empty($itemArray['freeTag']) ? $itemArray['freeTag'] : '', 'item_place' => !empty($itemArray['place']) ? $itemArray['place'] : '', 'item_eventdate' => !empty($itemArray['eventDate']) ? $itemArray['eventDate'] : '', 'item_date' => !empty($itemArray['pubDate']) ? $itemArray['pubDate'] : date('r'), 'item_tel' => !empty($itemArray['telephone']) ? $itemArray['telephone'] : '', 'item_transportation' => !empty($itemArray['transportation']) ? $itemArray['transportation'] : '', 'item_web' => !empty($itemArray['web']) ? $itemArray['web'] : '', 'item_mail' => !empty($itemArray['mail']) ? $itemArray['mail'] : '', 'item_opening' => !empty($itemArray['opening']) ? $itemArray['opening'] : '')));
    return $myDoc;
}