Ejemplo n.º 1
0
 /**
  * Saves newscontent as passed by post-paras via an xml-request.
  * Params expected are: newstitle, newsintro, newsimage, newstext, categories, startdate, enddate, archivedate
  *
  * @return string
  * @xml
  */
 protected function actionUpdateNewsXml()
 {
     $objNews = new class_module_news_news($this->getSystemid());
     if ($objNews->rightEdit() || $this->getSystemid() == "") {
         $arrCats = array();
         foreach (explode(",", $this->getParam("categories")) as $strCatId) {
             $arrCats[$strCatId] = "c";
         }
         $objNews->setStrTitle($this->getParam("newstitle"));
         $objNews->setStrIntro($this->getParam("newsintro"));
         $objNews->setStrImage($this->getParam("newsimage"));
         $objNews->setStrText($this->getParam("newstext"));
         if ($this->getParam("startdate") > 0) {
             $objDate = new class_date($this->getParam("startdate"));
             $objNews->setObjDateStart($objDate);
         }
         if ($this->getParam("enddate") > 0) {
             $objDate = new class_date($this->getParam("enddate"));
             $objNews->setObjDateEnd($objDate);
         }
         if ($this->getParam("archivedate") > 0) {
             $objDate = new class_date($this->getParam("archivedate"));
             $objNews->setObjDateSpecial($objDate);
         }
         $objNews->setArrCats($arrCats);
         if ($objNews->updateObjectToDb()) {
             $strReturn = "<success></success>";
         } else {
             $strReturn = "<error></error>";
         }
     } else {
         $strReturn = "<error>" . $this->getLang("commons_error_permissions") . "</error>";
     }
     return $strReturn;
 }