Example #1
0
 /**
  * Method to set the default property for a zone
  *
  * @return     void
  */
 public function defaultTask()
 {
     // Get item to default from request
     $id = Request::getVar('id', [], '', 'array');
     if (empty($id)) {
         App::abort(404, Lang::txt('COM_TOOLS_ERROR_MISSING_ID'));
     }
     // Get the middleware database
     $mwdb = Utils::getMWDBO();
     $row = new \Components\Tools\Tables\Zones($mwdb);
     if ($row->load($id[0])) {
         // Get rid of the current default
         $default = new \Components\Tools\Tables\Zones($mwdb);
         $default->load(['is_default' => 1]);
         $default->is_default = 0;
         if (!$default->store()) {
             App::abort(500, Lang::txt('COM_TOOLS_ERROR_DEFAULT_UPDATE_FAILED'));
         }
         // Set a new default
         $row->is_default = 1;
         if (!$row->store()) {
             App::abort(500, Lang::txt('COM_TOOLS_ERROR_DEFAULT_UPDATE_FAILED'));
         }
     }
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false));
 }
Example #2
0
 /**
  * Get a list of zones
  *
  * @param      string $rtrn    Data type to return [count, list]
  * @param      array  $filters Filters to apply to query
  * @return     mixed Returns an integer or array depending upon format chosen
  */
 public function zones($rtrn = 'list', $filters = array(), $clear = false)
 {
     $tbl = new \Components\Tools\Tables\Zones($this->_db);
     switch (strtolower($rtrn)) {
         case 'count':
             if (!isset($this->_cache['zones.count']) || $clear) {
                 $this->_cache['zones.count'] = $tbl->find('count', $filters);
             }
             return $this->_cache['zones.count'];
             break;
         case 'list':
         case 'results':
         default:
             if (!$this->_cache['zones.list'] instanceof ItemList || $clear) {
                 if ($results = $tbl->find('list', $filters)) {
                     foreach ($results as $key => $result) {
                         $results[$key] = new Zone($result);
                     }
                 } else {
                     $results = array();
                 }
                 $this->_cache['zones.list'] = new ItemList($results);
             }
             return $this->_cache['zones.list'];
             break;
     }
 }
Example #3
0
?>
</th>
				<th scope="col"><?php 
echo Lang::txt('COM_TOOLS_COL_PUBLISH_DOWN');
?>
</th>
				<th scope="col">X</th>
			</tr>
		</thead>
		<tbody>
<?php 
$i = 0;
$k = 0;
foreach ($this->rows as $row) {
    // Grab the zone name
    $zone = new \Components\Tools\Tables\Zones($mwdb);
    $zone->load($row->zone_id);
    ?>
			<tr class="<?php 
    echo "row{$k}";
    ?>
">
				<td>
					<a class="edit-asset" rel="{handler: 'iframe', size: {x: 570, y: 550}}" href="<?php 
    echo Route::url('index.php?option=' . $this->option . '&controller=' . $this->controller . '&task=editZone&id=' . $row->id . '&tmpl=component');
    ?>
">
						<?php 
    echo $this->escape(stripslashes($zone->title));
    ?>
					</a>