コード例 #1
0
ファイル: helper.php プロジェクト: kevinwojo/hubzero-cms
 /**
  * Get the list of billboads in the selected collection
  *
  * @return array
  */
 private function getList()
 {
     // Get the correct billboards collection to display from the parameters
     $collection = (int) $this->params->get('collection', 1);
     // Grab all the buildboards associated with the selected collection
     // Make sure we only grab published billboards
     $rows = Billboard::whereEquals('published', 1)->whereEquals('collection_id', $collection)->order('ordering', 'asc')->rows();
     return $rows;
 }
コード例 #2
0
ファイル: billboards.php プロジェクト: zooley/hubzero-cms
 /**
  * Toggle a billboard between published and unpublished.  We're looking for an array of ID's to publish/unpublish
  *
  * @param  $publish: 1 to publish and 0 for unpublish
  * @return void
  */
 protected function toggle($publish = 1)
 {
     // Check for request forgeries
     Request::checkToken(['get', 'post']);
     // Incoming (we're expecting an array)
     $ids = Request::getVar('cid', array());
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     // Loop through the IDs
     foreach ($ids as $id) {
         // Load the billboard
         $row = Billboard::oneOrFail($id);
         // Only alter items not checked out or checked out by 'me'
         if (!$row->isCheckedOut()) {
             $row->set('published', $publish);
             if (!$row->save()) {
                 App::abort(500, $row->getError());
                 return;
             }
             // Check it back in
             $row->checkin();
         } else {
             App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_BILLBOARDS_ERROR_CHECKED_OUT'), 'warning');
             return;
         }
     }
     // Redirect
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false));
 }
コード例 #3
0
ファイル: edit.php プロジェクト: mined-gatech/hubzero-cms
</option>
						<?php 
}
?>
					</select>
				</div>
				<div class="input-wrap">
					<label for="ordering"><?php 
echo Lang::txt('COM_BILLBOARDS_FIELD_ORDERING');
?>
:</label><br />
					<?php 
if ($this->row->id) {
    ?>
						<?php 
    $query = Billboard::select('ordering', 'value')->select('name', 'text')->whereEquals('collection_id', $this->row->collection_id)->toString();
    ?>
						<?php 
    echo JHTML::_('list.ordering', 'billboard[ordering]', $query, null, $this->row->id);
    ?>
					<?php 
} else {
    ?>
						<input type="hidden" name="billboard[ordering]" id="ordering" value="" />
						<span class="readonly"><?php 
    echo Lang::txt('COM_BILLBOARDS_ASC');
    ?>
</span>
					<?php 
}
?>
コード例 #4
0
ファイル: billboards.php プロジェクト: kevinwojo/hubzero-cms
 /**
  * Toggle a billboard between published and unpublished.
  * We're looking for an array of ID's to publish/unpublish
  *
  * @return  void
  */
 public function stateTask()
 {
     // Check for request forgeries
     Request::checkToken(['get', 'post']);
     if (!User::authorise('core.edit.state', $this->_option)) {
         App::abort(403, Lang::txt('JERROR_ALERTNOAUTHOR'));
     }
     // Incoming (we're expecting an array)
     $ids = Request::getVar('cid', array());
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     $publish = $this->getTask() == 'publish' ? 1 : 0;
     // Loop through the IDs
     foreach ($ids as $id) {
         // Load the billboard
         $row = Billboard::oneOrFail($id);
         // Only alter items not checked out or checked out by 'me'
         if (!$row->isCheckedOut()) {
             $row->set('published', $publish);
             if (!$row->save()) {
                 App::abort(500, $row->getError());
             }
             // Check it back in
             $row->checkin();
         } else {
             Notify::warning(Lang::txt('COM_BILLBOARDS_ERROR_CHECKED_OUT'));
         }
     }
     // Redirect
     $this->cancelTask();
 }