Пример #1
0
 /**
  * Get the user based on his login.
  * Return SingleRow if user was found; null, otherwise
  *
  * @param string $username
  * @return boolean
  * */
 public function removeUserName($username)
 {
     //anydataset.SingleRow
     $user = $this->getByUsername($username);
     if ($user !== null) {
         $this->_anyDataSet->removeRow($user);
         return true;
     } else {
         return false;
     }
 }
Пример #2
0
 /**
  * @access public
  * @param array $options
  * @return void
  */
 public function updateCustomConfig($options)
 {
     //processor.AnydatasetFilenameProcessor
     $configFile = new AnydatasetFilenameProcessor("customconfig");
     $phyFile = $this->CurrentSitePath() . $configFile->FullQualifiedName();
     //anydataset.AnyDataset
     $config = new AnyDataset($phyFile->FullQualifiedNameAndPath());
     //anydataset.AnyIterator
     $it = $config->getIterator();
     if ($it->hasNext()) {
         $config->removeRow(0);
     }
     $config->appendRow();
     foreach (array_keys($options) as $key) {
         if (trim($options[$key]) != "") {
             $this->addPairToConfig($key, $options[$key]);
             $config->addField($key, $options[$key]);
         }
     }
     $config->Save($phyFile);
 }
Пример #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;
 }