• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Services/Block/classes/class.ilExternalFeedBlockGUIGen.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2006 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 include_once("Services/Block/classes/class.ilBlockGUI.php");
00025 define("IL_FORM_EDIT", 0);
00026 define("IL_FORM_CREATE", 1);
00027 define("IL_FORM_RE_EDIT", 2);
00028 define("IL_FORM_RE_CREATE", 3);
00029 
00036 abstract class ilExternalFeedBlockGUIGen extends ilBlockGUI
00037 {
00038 
00039         protected $gui_object;
00040         protected $form_edit_mode;
00041 
00046         public function __construct()
00047         {
00048                 global $ilCtrl;
00049                 
00050                 $this->ctrl = $ilCtrl;
00051                 
00052                 
00053                 include_once("Services/Block/classes/class.ilExternalFeedBlock.php");
00054                 if ($_GET["external_feed_block_id"] > 0)
00055                 {
00056                         $this->external_feed_block = new ilExternalFeedBlock($_GET["external_feed_block_id"]);
00057                 }
00058                 
00059                 $this->ctrl->saveParameter($this, array("external_feed_block_id"));
00060                 
00061 
00062         }
00063 
00068         public function &executeCommand()
00069         {
00070                 global $ilCtrl;
00071                 
00072                 // get next class and command
00073                 $next_class = $this->ctrl->getNextClass($this);
00074                 $cmd = $this->ctrl->getCmd();
00075                 
00076                 switch ($next_class)
00077                 {
00078                         default:
00079                                 $html = $this->$cmd();
00080                                 break;
00081                 }
00082                 
00083                 return $html;
00084 
00085         }
00086 
00092         public function setGuiObject(&$a_gui_object)
00093         {
00094                 $this->gui_object = $a_gui_object;
00095         }
00096 
00102         public function getGuiObject()
00103         {
00104                 return $this->gui_object;
00105         }
00106 
00112         public function setFormEditMode($a_form_edit_mode)
00113         {
00114                 $this->form_edit_mode = $a_form_edit_mode;
00115         }
00116 
00122         public function getFormEditMode()
00123         {
00124                 return $this->form_edit_mode;
00125         }
00126 
00131         public function createFeedBlock()
00132         {
00133                 $this->initFormFeedBlock(IL_FORM_CREATE);
00134                 return $this->form_gui->getHtml();
00135 
00136         }
00137 
00142         public function editFeedBlock()
00143         {
00144                 $this->initFormFeedBlock(IL_FORM_EDIT);
00145                 $this->getValuesFeedBlock();
00146                 return $this->form_gui->getHtml();
00147 
00148         }
00149 
00154         public function saveFeedBlock()
00155         {
00156                 $this->initFormFeedBlock(IL_FORM_CREATE);
00157                 if ($this->form_gui->checkInput())
00158                 {
00159                         $this->external_feed_block = new ilExternalFeedBlock();
00160                         $this->external_feed_block->setTitle($this->form_gui->getInput("block_title"));
00161                         $this->external_feed_block->setFeedUrl($this->form_gui->getInput("block_feed_url"));
00162                         $this->prepareSaveFeedBlock($this->external_feed_block);
00163                         $this->external_feed_block->create();
00164                         $this->exitSaveFeedBlock();
00165                 }
00166                 else
00167                 {
00168                         $this->form_gui->setValuesByPost();
00169                         return $this->form_gui->getHtml();
00170                 }
00171 
00172         }
00173 
00178         public function updateFeedBlock()
00179         {
00180                 $this->initFormFeedBlock(IL_FORM_EDIT);
00181                 if ($this->form_gui->checkInput())
00182                 {
00183                         
00184                         $this->external_feed_block->setTitle($this->form_gui->getInput("block_title"));
00185                         $this->external_feed_block->setFeedUrl($this->form_gui->getInput("block_feed_url"));
00186                         $this->external_feed_block->update();
00187                         $this->exitUpdateFeedBlock();
00188                 }
00189                 else
00190                 {
00191                         $this->form_gui->setValuesByPost();
00192                         return $this->form_gui->getHtml();
00193                 }
00194 
00195         }
00196 
00202         public function initFormFeedBlock($a_mode)
00203         {
00204                 global $lng;
00205                 
00206                 $lng->loadLanguageModule("block");
00207                 
00208                 include("Services/Form/classes/class.ilPropertyFormGUI.php");
00209                 
00210                 $this->form_gui = new ilPropertyFormGUI();
00211                 
00212                 
00213                 // Property Title
00214                 $text_input = new ilTextInputGUI($lng->txt("block_feed_block_title"), "block_title");
00215                 $text_input->setInfo("");
00216                 $text_input->setRequired(true);
00217                 $text_input->setMaxLength(200);
00218                 $this->form_gui->addItem($text_input);
00219                 
00220                 // Property FeedUrl
00221                 $text_input = new ilTextInputGUI($lng->txt("block_feed_block_feed_url"), "block_feed_url");
00222                 $text_input->setInfo($lng->txt("block_feed_block_feed_url_info"));
00223                 $text_input->setRequired(true);
00224                 $text_input->setMaxLength(250);
00225                 $this->form_gui->addItem($text_input);
00226                 
00227                 
00228                 // save and cancel commands
00229                 if (in_array($a_mode, array(IL_FORM_CREATE,IL_FORM_RE_CREATE)))
00230                 {
00231                         $this->form_gui->addCommandButton("saveFeedBlock", $lng->txt("save"));
00232                         $this->form_gui->addCommandButton("cancelSaveFeedBlock", $lng->txt("cancel"));
00233                 }
00234                 else
00235                 {
00236                         $this->form_gui->addCommandButton("updateFeedBlock", $lng->txt("save"));
00237                         $this->form_gui->addCommandButton("cancelUpdateFeedBlock", $lng->txt("cancel"));
00238                 }
00239                 
00240                 $this->form_gui->setTitle($lng->txt("block_feed_block_head"));
00241                 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
00242                 
00243                 $this->prepareFormFeedBlock($this->form_gui);
00244 
00245         }
00246 
00251         public function getValuesFeedBlock()
00252         {
00253                 $values = array();
00254                 
00255                 $values["block_title"] = $this->external_feed_block->getTitle();
00256                 $values["block_feed_url"] = $this->external_feed_block->getFeedUrl();
00257                 
00258                 $this->form_gui->setValuesByArray($values);
00259 
00260         }
00261 
00266         public function cancelSaveFeedBlock()
00267         {
00268                 global $ilCtrl;
00269 
00270                 $ilCtrl->returnToParent($this);
00271         }
00272 
00277         public function cancelUpdateFeedBlock()
00278         {
00279                 global $ilCtrl;
00280 
00281                 $ilCtrl->returnToParent($this);
00282         }
00283 
00288         public function exitSaveFeedBlock()
00289         {
00290                 global $ilCtrl;
00291 
00292                 $ilCtrl->returnToParent($this);
00293         }
00294 
00299         public function exitUpdateFeedBlock()
00300         {
00301                 global $ilCtrl;
00302 
00303                 $ilCtrl->returnToParent($this);
00304         }
00305 
00311         public function prepareSaveFeedBlock(&$a_external_feed_block)
00312         {
00313 
00314         }
00315 
00321         public function prepareFormFeedBlock(&$a_form_gui)
00322         {
00323 
00324         }
00325 
00326 
00327 }
00328 ?>

Generated on Fri Dec 13 2013 17:56:55 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1