Source for file actions.class.php
Documentation is available at actions.class.php
* @version SVN: $Id: actions.class.php 12474 2008-10-31 10:41:27Z fabien $
$this->etva_mac_list = EtvaMacPeer::doSelect(new Criteria());
// public function executeJsonUpdate(sfWebRequest $request){
// $mac = $request->getParameter('mac');
// $query = ($this->getRequestParameter('query'))? json_decode($this->getRequestParameter('query'),true) : array();
// $criteria = new Criteria();
// $criteria->add(EtvaMacPeer::MAC, $mac);
// $etva_mac = EtvaMacPeer::doSelectOne($criteria);
// foreach($query as $key=>$val){
// $column = EtvaMacPeer::translateFieldName(sfInflector::camelize($key), BasePeer::TYPE_PHPNAME, BasePeer::TYPE_COLNAME);
// $etva_mac->setByName($column, $val);
// $result = array('success'=>true);
// $result = json_encode($result);
// $this->getContext()->getResponse()->setHttpHeader("X-JSON", '()'); // set a header, (although it is empty, it is nicer than without a correct header. Filling the header with the result will not be parsed by extjs as far as I have seen).
// return $this->renderText($result);
$isAjax = $request->isXmlHttpRequest();
// if(!$isAjax) return $this->redirect('@homepage');
// $this->getUser()->getAttributeHolder()->remove('macs_in_wizard');
$criteria = new Criteria();
$session_macs = $this->getUser()->getAttribute('macs_in_wizard', array());
//if($session_macs){ print_r($session_macs);
foreach($session_macs as $index=> $item){
//$value = $item->getMac();
$macs_in_use[] = $item['Id'];
$criteria->add(EtvaMacPeer::ID, $macs_in_use, Criteria::NOT_IN);
$info = array('success'=> false,'errors'=> 'No macs available in pool');
$error = $this->setJsonError($info);
return $this->renderText($error);
$mac = $etva_mac->toArray();
// fetch jobs already stored in the job history
// $session_macs = $this->getUser()->getAttribute('macs_in_wizard', array());
// add the current job at the beginning of the array
// store the new job history back into the session
$this->getUser()->setAttribute('macs_in_wizard', $session_macs);
// Store data in the user session
// $this->getUser()->setAttribute('macs_in_wizard', array$mac);
// $etva_mac->setInUse(1);
$this->getResponse()->setHttpHeader("X-JSON", '()'); // set a header, (although it is empty, it is nicer than without a correct header. Filling the header with the result will not be parsed by extjs as far as I have seen).
return $this->renderText($result);
$isAjax = $request->isXmlHttpRequest();
if(!$isAjax) return $this->redirect('@homepage');
$result = array('success'=> true);
$this->getContext()->getResponse()->setHttpHeader("X-JSON", '()'); // set a header, (although it is empty, it is nicer than without a correct header. Filling the header with the result will not be parsed by extjs as far as I have seen).
return $this->renderText($result);
for($i= 0;$i< $pool_size;$i++ ){
$isAjax = $request->isXmlHttpRequest();
if(!$isAjax) return $this->redirect('@homepage');
$query = ($this->getRequestParameter('query'))? json_decode($this->getRequestParameter('query'),true) : array();
$criteria = new Criteria();
foreach($query as $key=> $val){
$column = EtvaMacPeer::translateFieldName(sfInflector::camelize($key), BasePeer::TYPE_PHPNAME, BasePeer::TYPE_COLNAME);
$criteria->add($column, $val);
$this->etva_mac_list = EtvaMacPeer::doSelect($criteria);
foreach ($this->etva_mac_list as $etva_mac)
$macs[] = $etva_mac->toArray();
$this->getResponse()->setHttpHeader("X-JSON", '()'); // set a header, (although it is empty, it is nicer than without a correct header. Filling the header with the result will not be parsed by extjs as far as I have seen).
return $this->renderText($result);
$etva_mac_list = EtvaMacPeer::doSelect(new Criteria());
foreach($etva_mac_list as $mac)
$tree[] = array('id'=> $mac->getId(),'uiProvider'=> 'col','iconCls'=> 'devices-folder','text'=> $mac->getMac(),'in_use'=> $mac->getInUse(),'singleClickExpand'=> true,'leaf'=> true);
$this->getResponse()->setHttpHeader("X-JSON", '()');
return $this->renderText($result);
$this->form = new EtvaMacForm();
$this->forward404Unless($request->isMethod('post'));
$this->form = new EtvaMacForm();
$this->setTemplate('new');
$this->forward404Unless($etva_mac = EtvaMacPeer::retrieveByPk($request->getParameter('id')), sprintf('Object etva_mac does not exist (%s).', $request->getParameter('id')));
$this->form = new EtvaMacForm($etva_mac);
$this->forward404Unless($request->isMethod('post') || $request->isMethod('put'));
$this->forward404Unless($etva_mac = EtvaMacPeer::retrieveByPk($request->getParameter('id')), sprintf('Object etva_mac does not exist (%s).', $request->getParameter('id')));
$this->form = new EtvaMacForm($etva_mac);
$this->setTemplate('edit');
$request->checkCSRFProtection();
$this->forward404Unless($etva_mac = EtvaMacPeer::retrieveByPk($request->getParameter('id')), sprintf('Object etva_mac does not exist (%s).', $request->getParameter('id')));
$this->redirect('mac/index');
protected function processForm(sfWebRequest $request, sfForm $form)
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
$etva_mac = $form->save();
$this->redirect('mac/edit?id='. $etva_mac->getId());
private function setJsonError($info,$statusCode = 400){
$this->getContext()->getResponse()->setStatusCode($statusCode);
$this->getContext()->getResponse()->setHttpHeader("X-JSON", '()');
|