/**
  *
  * @param string $singlename
  */
 public function __construct($singlename)
 {
     parent::__construct($singlename);
     $this->_filenameLocation = ForceFilenameLocation::SharedPath;
 }
Пример #2
0
 /**
  *@param AnydatasetBaseFilenameProcessor $langFile
  *@return void
  *@desc Load Languages
  */
 public function LoadLanguages($langFile)
 {
     $all = $langFile->ToString() == "_all";
     if (!$all) {
         $this->LoadLanguages(new AnydatasetLangFilenameProcessor("_all"));
     }
     $this->_loadedFromFile = false;
     $paths = array();
     if ($langFile->getFilenameLocation() == ForceFilenameLocation::UseWhereExists || $langFile->getFilenameLocation() == ForceFilenameLocation::SharedPath) {
         $paths[] = $langFile->SharedPath();
     }
     if ($langFile->getFilenameLocation() == ForceFilenameLocation::UseWhereExists || $langFile->getFilenameLocation() == ForceFilenameLocation::PrivatePath) {
         $paths = array_merge($paths, $langFile->PrivatePath());
     }
     foreach ($paths as $path) {
         $filename = $path . $langFile->FullQualifiedName();
         $this->_debugInfo .= $langFile->ToString() . " in " . $filename . ' ';
         if (!FileUtil::Exists($filename)) {
             $this->_debugInfo .= "[Does not exists]; \n";
             continue;
         }
         $this->_debugInfo .= "[Exists]; \n";
         $curLang = strtolower($this->_context->Language()->getName());
         try {
             $lang = new AnyDataset($filename);
         } catch (Exception $e) {
             throw new EngineException('Can\'t load language file "' . $langFile->FullQualifiedName() . '"! ' . $e->getMessage());
         }
         $itf = new IteratorFilter();
         $itf->addRelation("LANGUAGE", Relation::EQUAL, $curLang);
         //AnyIterator
         $it = $lang->getIterator($itf);
         if ($it->hasNext()) {
             //SingleRow
             $sr = $it->moveNext();
             $names = $sr->getFieldNames();
             foreach ($names as $name) {
                 $this->addText($curLang, $name, $sr->getField($name));
             }
             $this->_loadedFromFile = true;
         }
     }
 }
Пример #3
0
 /**
  *@desc Execute the proper action to insert, update and delete $data from database.
  *@param Context $context
  *@return IXmlnukeDocumentObject $it contains all necessary XML to inform the user the operation result
  */
 public function updateRecord()
 {
     $message = "";
     //		IXmlnukeDocumentObject $mdo
     $mdo = $this->validateUpdate();
     if ($mdo != null) {
         return $mdo;
     }
     $data = new AnyDataset($this->_anydata->FullQualifiedNameAndPath());
     if ($this->_currentAction == self::ACTION_NEW_CONFIRM) {
         $data->appendRow();
         for ($i = 0, $fieldLength = sizeof($this->_fields); $i < $fieldLength; $i++) {
             $value = $this->_context->get($this->_fields[$i]->fieldName);
             if ($this->_fields[$i]->beforeInsertFormatter != null) {
                 $value = $this->_fields[$i]->beforeInsertFormatter->Format($srCurInfo, $this->_fields[$i]->fieldName, $value);
             }
             $data->addField($this->_fields[$i]->fieldName, $value);
         }
     } else {
         $itf = $this->getIteratorFilterKey();
         $it = $data->getIterator($itf);
         if ($it->hasNext()) {
             $sr = $it->moveNext();
             if ($this->_currentAction == self::ACTION_EDIT_CONFIRM) {
                 for ($i = 0, $fieldsLength = sizeof($this->_fields); $i < $fieldsLength; $i++) {
                     $value = $this->_context->get($this->_fields[$i]->fieldName);
                     if ($this->_fields[$i]->fieldXmlInput == XmlInputObjectType::FILEUPLOAD) {
                         $files = $this->_context->getUploadFileNames();
                         if ($files[$this->_fields[$i]->fieldName] == "") {
                             continue;
                         }
                         // Do nothing if none files are uploaded.
                     }
                     if ($this->_fields[$i]->beforeInsertFormatter != null) {
                         $value = $this->_fields[$i]->beforeInsertFormatter->Format($srCurInfo, $this->_fields[$i]->fieldName, $value);
                     }
                     $sr->setField($this->_fields[$i]->fieldName, $value);
                 }
             } else {
                 if ($this->_currentAction == self::ACTION_DELETE_CONFIRM) {
                     $data->removeRow($sr);
                     // Remove the Current Row;
                 }
             }
         }
     }
     $data->Save($this->_anydata);
     //XmlFormCollection $retorno = new XmlFormCollection($this->_context, $this->_module, $message);
     //$retorno->addXmlnukeObject(new XmlInputHidden("filter", $this->_filter));
     //$retorno->addXmlnukeObject(new XmlInputHidden("sort", $this->_sort));
     //$retorno->addXmlnukeObject(new XmlInputHidden("curpage", $this->_curPage->ToString()));
     //$retorno->addXmlnukeObject(new XmlInputHidden("offset", $this->_qtdRows->ToString()));
     //XmlInputButtons btnRetorno = new XmlInputButtons();
     //btnRetorno->addSubmit("Retornar", "");
     //$retorno->addXmlnukeObject(btnRetorno);
     //		XmlParagraphCollection $retorno
     return null;
 }
 public function Extension()
 {
     return ".lang" . parent::Extension();
 }
Пример #5
0
 /**
  *
  * @param string $singlename
  */
 public function __construct($singlename)
 {
     parent::__construct($singlename);
 }