Example #1
0
    function PlantillaEncabezado($title)
    {
        $area = new Area($_SESSION['session'][5]);
        ?>

        <table id="cabecera" cellpadding="0" cellspacing="0" width="100%" style="margin:0px;">
    		<tr>
    			<td class="superior"><img src="public_root/imgs/cabecera.jpg" alt="cabecera" border="0" style="margin:0px" width="1000" height="80"/> </td>
    		</tr>
    		<tr>
    			<td class="vertical_line">
                    <table  cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <td class="home">  </td>
                        <td align="left" class="usuario"><?php 
        echo ucwords($_SESSION['session'][1]);
        ?>
</td>
                        <td align="center" class="titulo"><?php 
        echo $title;
        ?>
 - <?php 
        echo $area->getNombre();
        ?>
</td>
                        <td align="right" class="cerrar_sesion"><a href="#" onclick="javascript:eliminar_sesion()">CERRAR SESION</a></td>
                    </tr>
                    </table>
                </td>
            </tr>
    	</table>
    	<?php 
    }
Example #2
0
 /**
  * Returns a formatted text for the number of comments in the first comment block in the "Entry Comments" area
  * @param string $singular_format
  * @param string $plural_format
  * @param string $disabled_message
  * @return string
  */
 public function getCommentCountString($singular_format, $plural_format, $disabled_message = '')
 {
     $count = 0;
     $comments_enabled = false;
     $c = $this->getCollectionObject();
     $a = new Area('Blog Post Footer');
     $blocks = $a->getAreaBlocksArray($c);
     if (is_array($blocks) && count($blocks) > 0) {
         foreach ($blocks as $b) {
             if ($b->getBlockTypeHandle() == 'guestbook') {
                 $controller = $b->getInstance();
                 $count = $controller->getEntryCount($c->getCollectionID());
                 $comments_enabled = true;
                 break;
                 // stop at the fist guestbook block found
             }
         }
     }
     if ($comments_enabled) {
         $format = $count == 1 ? $singular_format : $plural_format;
         return sprintf($format, $count);
     } else {
         return $disabled_message;
     }
 }
Example #3
0
 /**
  * @param Area $area 
  */
 public function deleting(Area $area)
 {
     $area->groups->each(function ($m) {
         $m->delete();
     });
     $area->categories()->delete();
     $area->sponsors()->detach();
 }
 /**
  * Inseri um registro na tabela
  *
  * @parametro TematicaMySql tematica
  */
 public function insert(Area $area)
 {
     $sql = "INSERT INTO {$this->table} (nome) VALUES ( :nome)";
     $nome = $area->getNome();
     $stmt = ConnectionFactory::prepare($sql);
     $stmt->bindParam(':nome', $nome);
     return $stmt->execute();
 }
Example #5
0
 function listaroptions()
 {
     $id = $_REQUEST['id'];
     $area = new Area();
     $data = $area->listadoOptionsarea($id);
     $tot = count($data);
     for ($i = 0; $i < $tot; $i++) {
         echo '<option value="' . $data[$i]['idarea'] . '">' . $data[$i]['nombre'];
     }
 }
Example #6
0
 /**
  *
  * @param desde
  * @param numeroElementos
  */
 public function cargar($desde = 0, $numeroElementos = 0)
 {
     $db = FabricaBaseDatos::crear();
     $select = $db->select()->from('area')->limit($numeroElementos, $desde);
     $rows = $db->fetchAll($select);
     foreach ($rows as $row) {
         $unArea = new Area($row['id_area']);
         $unArea->set_nombre($row['nombre']);
         $unArea->set_descripcion($row['descripcion']);
         array_push($this->_elementos, $unArea);
     }
     return true;
 }
Example #7
0
 /**
  * @return Area
  */
 protected function getAreaHelper()
 {
     if (null === $this->areaHelper) {
         if (method_exists($this->view, 'plugin')) {
             $this->areaHelper = $this->view->plugin($this->defaultAreaHelper);
         }
         if (!$this->areaHelper instanceof Area) {
             $this->areaHelper = new Area();
             $this->areaHelper->setView($this->getView());
         }
     }
     return $this->areaHelper;
 }
Example #8
0
{
    var $x = "";
    var $y = "";
    var $noiseavg = 0;
    // avg
    var $n = 0;
    // number of measurements
    function setData($x, $y)
    {
        $this->x = $x;
        $this->y = $y;
        return $this;
    }
    function addMeasurement($noise)
    {
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $rules = array("areaId" => "required", "areaName" => "required");
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('/area/create')->withErrors($validator);
     }
     //
     $area = new Area();
     $area->areaID = Input::get('areaId');
     $area->areaName = Input::get('areaName');
     $area->save();
     return Redirect::to('/area');
 }
 /**
  * 
  * @param desde
  * @param numeroElementos
  */
 public function cargar($desde = 0, $numeroElementos = 0)
 {
     if ($this->_idUsuario) {
         $db = FabricaBaseDatos::crear();
         $select = $db->select()->from('v_usuario_area')->limit($numeroElementos, $desde)->where('id_usuario = ?', $this->_idUsuario);
         $rows = $db->fetchAll($select);
         foreach ($rows as $row) {
             $unArea = new Area($row['id_area']);
             $unArea->set_nombre($row['nombre_area']);
             $unArea->set_descripcion($row['descripcion_area']);
             $this->_areas->add($unArea);
         }
     }
     return true;
 }
Example #11
0
 public function actionGet_route()
 {
     $criteria = new CDbCriteria();
     $criteria->limit = 8;
     $area = Area::model()->findAll($criteria);
     $html = '<ul class="local_trip_pro" id="local_trip_content_list" data-blockid="recommend_localjoin">';
     for ($j = 0; $j < count($area); $j++) {
         if ($j) {
             $html .= '<li class="local_trip_pro_li wq_clearfix hide" data-content="lj' . $j . '" style="display:none;">';
         } else {
             $html .= '<li class="local_trip_pro_li wq_clearfix" data-content="lj' . $j . '">';
         }
         $criteria1 = new CDbCriteria();
         $criteria1->condition = "(style & 4) !=0";
         $criteria1->addCondition('area ="' . $area[$j]->name . '"', 'AND');
         $criteria1->limit = 3;
         $route = Route::model()->findAll($criteria1);
         for ($i = 0; $i < count($route); $i++) {
             if ($i) {
                 $html .= '<a class="local_trip_right img_slide_animte_wrapper" href="';
             } else {
                 $html .= '<a class="local_trip_left_l img_slide_animte_wrapper" href="';
             }
             if ($i) {
                 $html .= '#" target="_blank"> <img class="local_trip_img_s img_slide_animte first_page"  src="' . $route[$i]->source . '" data-original="' . $route[$i]->source . '" style="display: block;"> <span class="local_trip_mask_s"></span> <span class="local_trip_txt_s" title="' . $route[$i]->name . '">' . $route[$i]->name . '</span>' . '<span class="local_trip_price_s font_size12"><span class="font_size16">' . $route[$i]->price . '</span>元/人起</span></a>';
             } else {
                 $html .= '#" target="_blank"> <img class="local_trip_img_l img_slide_animte first_page" alt=" ' . $route[$i]->name . '" src="' . $route[$i]->source . '" data-original="' . $route[$i]->source . '" style="display: block;"> <span class="local_trip_mask_l"></span> <span class="local_trip_bl"></span><span class="local_trip_txt_l" title="' . $route[$i]->name . '">' . $route[$i]->name . '</span>' . '<span class="local_trip_price_l font_size14 font_color_orange"><span class="font_size28">' . $route[$i]->price . '</span>元/人起</span></a>';
             }
         }
         $html .= '</li>';
     }
     $html .= '</ul>';
     echo $html;
 }
Example #12
0
 /**
  * 根据地区woeid获取雅虎天气
  * 获取woeid http://sugg.us.search.yahoo.net/gossip-gl-location/?appid=weather&output=xml&command=地名(如香港)
  * 匹配规则:preg_match('/woeid=(\d+)\&amp;lon=.*?\&amp;lat=.*?\&amp;s=.*?\&amp;c=.*?\&amp;country_woeid/si', $_return,$match);
  * 获取天气:https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.media.weather%20where%20woeid%20in(12523356%2C90717580%2C20069923)&format=json&env=http%3A%2F%2Fdatatables.org%2Falltables.env&callback=
  */
 public function actionWeather()
 {
     ini_set('memory_limit', '256M');
     ini_set('max_execution_time', '1800');
     $areas = Area::model()->findAll(array('select' => 'woeid', 'condition' => 'woeid>0 AND theorder=3'));
     $woeids = array_keys(CHtml::listData($areas, 'woeid', ''));
     $woeidsStr = join(',', $woeids);
     $dir = Yii::app()->basePath . '/runtime/weather';
     $totalDir = $dir . '/total.log';
     zmf::createUploadDir($dir);
     $start = microtime(true);
     if ($woeidsStr != '') {
         $url = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.media.weather%20where%20woeid%20in({$woeidsStr})&format=json&env=http%3A%2F%2Fdatatables.org%2Falltables.env";
         $json = zmf::curlget($url);
         file_put_contents($totalDir, $json);
     }
     $dataArr = CJSON::decode($json, true);
     $data = $dataArr['query'];
     if (!$data) {
         exit('Failed');
     }
     $results = $data['results']['result'];
     $detailDir = $dir . '/detail/';
     zmf::createUploadDir($detailDir);
     foreach ($results as $result) {
         if ($result['location']['woeid']) {
             $_dir = $detailDir . $result['location']['woeid'] . '.log';
             file_put_contents($_dir, CJSON::encode($result));
         }
     }
     echo microtime(true) - $start . '--<br/>';
 }
Example #13
0
 public static function getList()
 {
     $model = Area::model();
     $command = $model->getDbConnection()->CreateCommand();
     $tableName = $model->tableName();
     return $command->select()->from($tableName)->order('create_time DESC')->queryAll();
 }
 public function __construct($id, $x, $y, $width, $height, $cx, $cy, $items, $world)
 {
     parent::__construct($id, $x, $y, $width, $height, $world);
     $this->items = $items;
     $this->chestX = $cx;
     $this->chestY = $cy;
 }
Example #15
0
 public static function getInstance()
 {
     if (!Area::$instance) {
         Area::$instance = new Area();
     }
     return Area::$instance;
 }
Example #16
0
 private function get_layout_blocks($cObj, $aHandle)
 {
     $blocks = array();
     $area = new Area($aHandle);
     $layouts = $area->getAreaLayouts($cObj);
     //returns empty array if no layouts
     foreach ($layouts as $layout) {
         $maxCell = $layout->getMaxCellNumber();
         for ($i = 1; $i <= $maxCell; $i++) {
             $cellAreaHandle = $layout->getCellAreaHandle($i);
             $cellBlocks = $cObj->getBlocks($cellAreaHandle);
             $blocks = array_merge($blocks, $cellBlocks);
         }
     }
     return $blocks;
 }
Example #17
0
 public function setPermissionObject(Area $a)
 {
     $ax = $a;
     if ($a->isGlobalArea()) {
         $cx = Stack::getByName($a->getAreaHandle());
         $a = Area::get($cx, STACKS_AREA_NAME);
     }
     $this->permissionObject = $a;
     // if the area overrides the collection permissions explicitly (with a one on the override column) we check
     if ($a->overrideCollectionPermissions()) {
         $this->permissionObjectToCheck = $a;
     } else {
         if ($a->getAreaCollectionInheritID() > 0) {
             // in theory we're supposed to be inheriting some permissions from an area with the same handle,
             // set on the collection id specified above (inheritid). however, if someone's come along and
             // reverted that area to the page's permissions, there won't be any permissions, and we
             // won't see anything. so we have to check
             $areac = Page::getByID($a->getAreaCollectionInheritID());
             $inheritArea = Area::get($areac, $a->getAreaHandlE());
             if (is_object($inheritArea) && $inheritArea->overrideCollectionPermissions()) {
                 // okay, so that area is still around, still has set permissions on it. So we
                 // pass our current area to our grouplist, userinfolist objects, knowing that they will
                 // smartly inherit the correct items.
                 $this->permissionObjectToCheck = $inheritArea;
             }
         }
         if (!$this->permissionObjectToCheck) {
             $this->permissionObjectToCheck = $a->getAreaCollectionObject();
         }
     }
 }
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'zone_id=' . $id;
     $area = new CActiveDataProvider(Area::model(), array('criteria' => $criteria));
     $this->render('view', array('model' => $this->loadModel($id), 'area' => $area));
 }
 public function getArea($idArea)
 {
     $connection = parent::initDB();
     $query = "SELECT idArea, nombreArea, departamento FROM area " . "WHERE idArea = {$idArea}";
     $result = mysql_query($query);
     if (mysql_num_rows($result) == 0) {
         throw new Exception('No se pudo obtener el área');
     }
     $row = mysql_fetch_array($result);
     $area = new Area();
     $area->setIdArea($row['idArea']);
     $area->setNombreArea($row['nombreArea']);
     $area->setDepartamento($row['departamento']);
     parent::closeDB($connection);
     return $area;
 }
Example #20
0
 public function on_start()
 {
     parent::on_start();
     $this->area = \Area::getOrCreate($this->page, $_REQUEST['arHandle']);
     $this->permissions = new \Permissions($this->area);
     $this->set('a', $this->area);
 }
 /**
  * Execute the console command.
  *
  *	@todo  DON'T UPDATE LOCATIONS IF THEY'RE ALREADY SET
  *
  * @return mixed
  */
 public function fire()
 {
     $Bodmin = Area::firstOrCreate(['name' => 'Bodmin']);
     // Ensure current locations are saved.
     foreach (array_unique(Interview::where('location_id', '=', '')->lists('location')) as $location) {
         if (strlen($location) === 0) {
             continue;
             // don't want to clobber real locations
         }
         $L = Location::firstOrNew(['name' => $location]);
         if ($L->exists) {
             continue;
         }
         $L->area()->associate($Bodmin);
         $L->save();
     }
     Interview::all()->each(function ($Interview) {
         $Location = Location::where('name', '=', $Interview->location);
         if ($Location->count() <= 0) {
             \Log::error("This location not found despite having just been confirmed a few lines above", $Interview->toArray());
             return;
         }
         $Interview->location_id = $Location->first()->id;
         $Interview->save();
     });
 }
 /**
  * Display a listing of the searched resource.
  *
  * @return Response
  */
 public function search()
 {
     if (Auth::check()) {
         $data["inside_url"] = Config::get('app.inside_url');
         $data["user"] = Session::get('user');
         // Verifico si el usuario es un Webmaster
         if ($data["user"]->idrol == 1 || $data["user"]->idrol == 2 || $data["user"]->idrol == 3 || $data["user"]->idrol == 4) {
             $data["search_nombre"] = Input::get('search_nombre');
             $data["search_categoria"] = Input::get('search_categoria');
             $data["search_servicio_clinico"] = Input::get('search_servicio_clinico');
             $data["search_departamento"] = Input::get('search_departamento');
             $data["search_responsable"] = Input::get('search_responsable');
             $data["search_fecha_ini"] = Input::get('search_fecha_ini');
             $data["search_fecha_fin"] = Input::get('search_fecha_fin');
             $data["categorias"] = ProyectoCategoria::all()->lists('nombre', 'id');
             $data["servicios"] = Servicio::all()->lists('nombre', 'idservicio');
             $data["departamentos"] = Area::all()->lists('nombre', 'idarea');
             $data["usuarios"] = User::orderBy('nombre')->get()->lists('UserFullName', 'id');
             $data["reportes_data"] = Proyecto::searchReporte($data['search_nombre'], $data['search_categoria'], $data['search_servicio_clinico'], $data['search_departamento'], $data['search_responsable'], $data["search_fecha_ini"], $data["search_fecha_fin"]);
             $data["proyectos_data"] = $data["reportes_data"]->paginate(10);
             return View::make('investigacion.proyecto.documentacion.index', $data);
         } else {
             return View::make('error/error', $data);
         }
     } else {
         return View::make('error/error', $data);
     }
 }
 public function view($updated = false)
 {
     Loader::library('database_indexed_search');
     if ($this->post('reindex')) {
         IndexedSearch::clearSearchIndex();
         $this->redirect('/dashboard/system/seo/search_index', 'index_cleared');
     } else {
         if ($updated) {
             $this->set('message', t('Search Index Preferences Updated'));
         }
         if ($this->isPost()) {
             if ($this->token->validate('update_search_index')) {
                 $areas = $this->post('arHandle');
                 if (!is_array($areas)) {
                     $areas = array();
                 }
                 Config::save('SEARCH_INDEX_AREA_LIST', serialize($areas));
                 Config::save('SEARCH_INDEX_AREA_METHOD', Loader::helper('security')->sanitizeString($this->post('SEARCH_INDEX_AREA_METHOD')));
                 $this->redirect('/dashboard/system/seo/search_index', 'updated');
             } else {
                 $this->set('error', array($this->token->getErrorMessage()));
             }
         }
         $areas = Area::getHandleList();
         $selectedAreas = array();
         $this->set('areas', $areas);
         $this->set('selectedAreas', IndexedSearch::getSavedSearchableAreas());
     }
 }
Example #24
0
 public function setPermissionObject(Block $b)
 {
     $this->permissionObject = $b;
     // if the area overrides the collection permissions explicitly (with a one on the override column) we check
     if ($b->overrideAreaPermissions()) {
         $this->permissionObjectToCheck = $b;
     } else {
         $a = $b->getBlockAreaObject();
         if (is_object($a)) {
             if ($a->overrideCollectionPermissions()) {
                 $this->permissionObjectToCheck = $a;
             } elseif ($a->getAreaCollectionInheritID()) {
                 $mcID = $a->getAreaCollectionInheritID();
                 $mc = Page::getByID($mcID, 'RECENT');
                 $ma = Area::get($mc, $a->getAreaHandle());
                 if ($ma->overrideCollectionPermissions()) {
                     $this->permissionObjectToCheck = $ma;
                 } else {
                     $this->permissionObjectToCheck = $ma->getAreaCollectionObject();
                 }
             } else {
                 $this->permissionObjectToCheck = $a->getAreaCollectionObject();
             }
         } else {
             $this->permissionObjectToCheck = Page::getCurrentPage();
         }
     }
 }
Example #25
0
 public function __construct()
 {
     parent::__construct();
     $request = $this->request;
     $arHandle = $request->query->get('arHandle');
     $bID = $request->query->get('bID');
     $a = \Area::get($this->page, $arHandle);
     if (!is_object($a)) {
         throw new \Exception('Invalid Area');
     }
     $this->area = $a;
     if (!$a->isGlobalArea()) {
         $b = \Block::getByID($bID, $this->page, $a);
         $this->set('isGlobalArea', false);
     } else {
         $stack = \Stack::getByName($arHandle);
         $sc = ConcretePage::getByID($stack->getCollectionID(), 'RECENT');
         $b = \Block::getByID($bID, $sc, STACKS_AREA_NAME);
         $b->setBlockAreaObject($a);
         // set the original area object
         $this->set('isGlobalArea', true);
     }
     $this->block = $b;
     $this->permissions = new \Permissions($b);
     $this->set('bp', $this->permissions);
     $this->set('b', $b);
 }
Example #26
0
 public function loadModel($id)
 {
     $model = Area::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     //
     $newId = Supplier::generateId();
     $areas = Area::all();
     $regions = Region::all();
     return View::make('supplier.new', ['id' => $newId, 'areas' => $areas, 'regions' => $regions]);
 }
Example #28
0
 public static function convert($row)
 {
     $subarea = new Area();
     $subarea->id = $row['id'];
     $subarea->nome = $row['nome'];
     $subarea->area = Area::find($row['area_id']);
     return $subarea;
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     //
     $newId = Warehouse::generateId();
     $areas = Area::all();
     $regions = Region::all();
     return View::make('warehouse.new', ['id' => $newId, 'areas' => $areas, 'regions' => $regions]);
 }
Example #30
0
    }
    function addMeasurement($noise)
    {
        $this->n = $this->n + 1;
        $this->noiseavg = $this->noiseavg + ($noise - $this->noiseavg) / $this->n;
        return $this;
    }
}
class Areas
{
    var $arrayOfAreas = array();
    var $max = -200;
    // necessary		// TODO: remove max from PHP
    function add($x, $y, $width, $height, $noise)
    {
        $found = false;
        foreach ($this->arrayOfAreas as $area) {
            if ($area->x == $x && $area->y == $y) {