Example #1
0
 public function executeNovaPagina(sfWebRequest $request)
 {
     if ($request->isXmlHttpRequest() || true) {
         //apenas por ajax
         sfConfig::set('sf_web_debug', false);
         sfProjectConfiguration::getActive()->loadHelpers(array('I18N', 'Date'));
         $cmspage = new Cmspage();
         $content = new Content();
         $content->setId(null);
         $cmspage->setContent($content);
         $cmspage->setId(null);
         $cmsGroupcontent = $this->getUser()->getAttribute('contentGroup');
         $this->forward404Unless($cmsGroupcontent);
         $cmspage->setCmsgroupcontent($cmsGroupcontent);
         $this->formContent = new PageContentForm($cmspage);
         if ($request->isMethod('post')) {
             //return $this->renderPartial('cms/debug',array('values'=>$request->getParameter('pagina')));
             $this->formContent->bind($request->getParameter('pagina'));
             if ($this->formContent->isValid()) {
                 $this->logMessage('O formContent foi vĂ¡lido. cms/actions: ' . __FILE__ . __LINE__);
                 try {
                     $this->formContent->save();
                     return $this->renderPartial("cms/viewPage", array('page' => $this->formContent->getCmspageobj(), 'isNew' => true, 'values' => $this->formContent->getValues()));
                 } catch (Exception $e) {
                     //TODO: We should to handle the error and render it.
                     throw $e;
                 }
                 //return $this->renderPartial("cms/viewPage",array('page'));
             }
         }
         //parent::executeNew($request);
         return $this->renderPartial('cms/content_form', array('formContent' => $this->formContent));
     }
 }
Example #2
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Cmspage the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Cmspage::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #3
0
 public function actionPages($id)
 {
     $this->containercls = 'nobackground';
     $model = Cmspage::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     } else {
         $this->render('pages', array('model' => $model));
     }
 }
Example #4
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Cmspage $value A Cmspage object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Cmspage $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }