applications/dashboard/controllers/class.messagecontroller.php
public function Edit($MessageID = '') {
      $this->AddJsFile('jquery.autogrow.js');
      $this->AddJsFile('messages.js');
         
      $this->Permission('Garden.Messages.Manage');
      $this->AddSideMenu('dashboard/message');
      
      // Generate some Controller & Asset data arrays
      $this->SetData('Locations', $this->_GetLocationData());
      $this->AssetData = $this->_GetAssetData();
      
      // Set the model on the form.
      $this->Form->SetModel($this->MessageModel);
      $this->Message = $this->MessageModel->GetID($MessageID);
      $this->Message = $this->MessageModel->DefineLocation($this->Message);
      
      // Make sure the form knows which item we are editing.
      if (is_numeric($MessageID) && $MessageID > 0)
         $this->Form->AddHidden('MessageID', $MessageID);
      
      $CategoriesData = CategoryModel::Categories();
      $Categories = array();
      foreach ($CategoriesData as $Row) {
         if ($Row['CategoryID'] < 0)
            continue;
         
         $Categories[$Row['CategoryID']] = str_repeat('&nbsp;&nbsp;&nbsp;', max(0, $Row['Depth'] - 1)).$Row['Name'];
      }
      $this->SetData('Categories', $Categories);

      // If seeing the form for the first time...
      if (!$this->Form->AuthenticatedPostBack()) {
         $this->Form->SetData($this->Message);
      } else {
         if ($MessageID = $this->Form->Save()) {
            // Reset the message cache
            $this->MessageModel->SetMessageCache();
            
            // Redirect
            $this->InformMessage(T('Your changes have been saved.'));
            //$this->RedirectUrl = Url('dashboard/message');
         }
      }
      $this->Render();
   }
public function Edit($MessageID = '') {
      $this->AddJsFile('jquery.autogrow.js');
      $this->AddJsFile('messages.js');
         
      $this->Permission('Garden.Messages.Manage');
      $this->AddSideMenu('dashboard/message');
      
      // Generate some Controller & Asset data arrays
      $this->SetData('Locations', $this->_GetLocationData());
      $this->AssetData = $this->_GetAssetData();
      
      // Set the model on the form.
      $this->Form->SetModel($this->MessageModel);
      $this->Message = $this->MessageModel->GetID($MessageID);
      $this->Message = $this->MessageModel->DefineLocation($this->Message);
      
      // Make sure the form knows which item we are editing.
      if (is_numeric($MessageID) && $MessageID > 0)
         $this->Form->AddHidden('MessageID', $MessageID);
      
      $CategoriesData = CategoryModel::Categories();
      $Categories = array();
      foreach ($CategoriesData as $Row) {
         if ($Row['CategoryID'] < 0)
            continue;
         
         $Categories[$Row['CategoryID']] = str_repeat('&nbsp;&nbsp;&nbsp;', max(0, $Row['Depth'] - 1)).$Row['Name'];
      }
      $this->SetData('Categories', $Categories);

      // If seeing the form for the first time...
      if (!$this->Form->AuthenticatedPostBack()) {
         $this->Form->SetData($this->Message);
      } else {
         if ($MessageID = $this->Form->Save()) {
            // Reset the message cache
            $this->MessageModel->SetMessageCache();
            
            // Redirect
            $this->InformMessage(T('Your changes have been saved.'));
            //$this->RedirectUrl = Url('dashboard/message');
         }
      }
      $this->Render();
   }
public function Edit ( $ MessageID = '' ) { $ this -> AddJsFile ( 'jquery.autogrow.js' ) ; $ this -> AddJsFile ( 'messages.js' ) ; $ this -> Permission ( 'Garden.Messages.Manage' ) ; $ this -> AddSideMenu ( 'dashboard/message' ) ; // Generate some Controller & Asset data arrays $ this -> SetData ( 'Locations' , $ this -> _GetLocationData ( ) ) ; $ this -> AssetData = $ this -> _GetAssetData ( ) ; // Set the model on the form. $ this -> Form -> SetModel ( $ this -> MessageModel ) ; $ this -> Message = $ this -> MessageModel -> GetID ( $ MessageID ) ; $ this -> Message = $ this -> MessageModel -> DefineLocation ( $ this -> Message ) ; // Make sure the form knows which item we are editing. if ( is_numeric ( $ MessageID ) && $ MessageID > 0 ) $ this -> Form -> AddHidden ( 'MessageID' , $ MessageID ) ; $ CategoriesData = CategoryModel :: Categories ( ) ; $ Categories = array ( ) ; foreach ( $ CategoriesData as $ Row ) { if ( $ Row [ 'CategoryID' ] < 0 ) continue ; $ Categories [ $ Row [ 'CategoryID' ] ] = str_repeat ( '&nbsp;&nbsp;&nbsp;' , max ( 0 , $ Row [ 'Depth' ] - 1 ) ) . $ Row [ 'Name' ] ; } $ this -> SetData ( 'Categories' , $ Categories ) ; // If seeing the form for the first time... if ( ! $ this -> Form -> AuthenticatedPostBack ( ) ) { $ this -> Form -> SetData ( $ this -> Message ) ; } else { if ( $ MessageID = $ this -> Form -> Save ( ) ) { // Reset the message cache $ this -> MessageModel -> SetMessageCache ( ) ; // Redirect $ this -> InformMessage ( T ( 'Your changes have been saved.' ) ) ; //$this->RedirectUrl = Url('dashboard/message'); } } $ this -> Render ( ) ; }
Form to edit an existing message.

@since 2.0.0
@access public
Form to edit an existing message .