Exemplo n.º 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));
 }
Exemplo n.º 2
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>
				</td>