function photos($id = null) { $this->layout = 'ajax'; header('Content-type: application/atom+xml'); if (!is_numeric($id)) { return; } $party = $this->Feed->findById($id); $this->set('party', $party); if (FLICKR_API_KEY != null && !$party['Feeds']['canceled']) { if ($party['Feeds']['useflickr'] == 1) { $data = array('type' => 'flickr', 'userid' => $party['Feeds']['flickrid'], 'randomize' => false); $flickr = new webServices($data); $photoset = $flickr->fetchPhotos(FLICKR_TAG_PREFIX . $id, 30, !$party['Feeds']['flickrperms']); $this->set('flickr', $photoset); } } }
function getCursoConCupo($id_filial, $cod_curso) { $cfile = 'cache/cupos.json'; // si ya esta el cache revisamos | agregar check de fecha y luego leemos if (file_exists($cfile)) { error_log("La última modificación de {$cfile} fue: " . date("F d Y H:i:s.", filectime($cfile)), 0); $str_cupos = file_get_contents($cfile); } else { $webservice = new webServices(); $str_cupos = $webservice->send("JSON_getCursosConCupo"); if (file_put_contents($cfile, $str_cupos)) { error_log("¡Se escribio el cache de comision con cupo!", 0); } else { error_log("¡Error al escribir el cache de comisiones con cupo!", 0); } } $cupos = json_decode($str_cupos, true); $curso_cupo = array(); if (count($cupos) > 0) { if (is_array($cupos[$id_filial])) { foreach ($cupos[$id_filial] as $id => $datos) { if ($datos['codigocurso'] == $cod_curso) { $curso_cupo[] = $datos; } } } // else { // echo "No hay comisiones con Cupos Disponibles para esta filial"; // } } return $curso_cupo; }
* The Original Code is Mozilla Party Tool * * The Initial Developer of the Original Code is * Ryan Flint <*****@*****.**> * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ if (empty($_REQUEST['s'])) { die; } include '../../vendors/webServices.php'; include '../../config/bootstrap.php'; $suggest = new webServices(array('type' => 'gsuggest')); $string = $suggest->GSuggest($_REQUEST['s']); header('Content-type: text/plain'); echo $string;
function view($id = null, $page = null) { if ($id == 'all') { $this->pageTitle = 'All Parties'; $this->set('current', 'parties'); //Paginate! $count = $this->Party->findCount(); $pages = ceil($count / 100); if ($page == null) { $page = 1; } if ($page > 1) { $this->set('prev', $page - 1); } if ($page < $pages) { $this->set('next', $page + 1); } $deck = $this->Party->findAll(null, null, "id ASC", 100, $page); shuffle($deck); $this->set('parties', $deck); } else { if (is_numeric($id)) { $party = $this->Party->findById($id); if (empty($party['Party']['id'])) { $this->redirect('/parties/view/all'); } $this->set('current', 'parties'); $this->set('host', $this->Party->getHost($party['Party']['owner'])); $this->set('party', $party); $this->set('isguest', $this->Party->isGuest($id, @$_SESSION['User']['id'])); $this->pageTitle = $party['Party']['name']; $this->set('map', 'mapInit(' . $party['Party']['lat'] . ',' . $party['Party']['long'] . ',' . $party['Party']['zoom'] . ',\'stationary\')'); $this->set('guests', $this->Party->getGuests($party['Party']['id'])); $this->set('comments', $this->Party->getComments($id)); if (FLICKR_API_KEY != null) { if ($party['Party']['useflickr'] == 1) { $data = array('type' => 'flickr', 'userid' => $party['Party']['flickrid'], 'randomize' => true); $flickr = new webServices($data); $photoset = $flickr->fetchPhotos(FLICKR_TAG_PREFIX . $party['Party']['id'], 15, $party['Party']['flickrperms'] ? false : true); $this->set('flickr', array_slice($photoset, 0, 9)); } } } else { $this->redirect('/parties/view/all'); } } }