本文整理汇总了PHP中Factory::loadObject方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::loadObject方法的具体用法?PHP Factory::loadObject怎么用?PHP Factory::loadObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Factory
的用法示例。
在下文中一共展示了Factory::loadObject方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeRequest
/**
* execute the actual ajax request
*/
protected function executeRequest()
{
$error = null;
$requestHelper = $this->controller->getRequestHelper();
$ret = BaseObject::SAVE_FAILURE;
try {
$class = $requestHelper->getParam('class');
$lk = (int) $requestHelper->getParam('LK');
$obj = Factory::loadObject($class, $lk);
if (empty($obj)) {
$this->msg = "Es wurde kein LK zum Löschen ausgewählt";
return;
} else {
}
$dbObj = base_database_connection_Mysql::get();
$dbObj->beginTransaction();
$ret = $obj->delete();
$dbObj->endTransaction();
} catch (Exception $e) {
$error = $e->getMessage();
}
if (!is_null($error)) {
$this->msg = $error;
return;
}
$this->returnCode = self::PROCEED_TO_NEXT_PAGE;
$this->redirectUrl = $_SERVER['HTTP_REFERER'];
if ($ret == BaseObject::DELETE_SUCCESS) {
$this->msg = "Der Datensatz '$lk' wurde erfolgreich gelöscht.";
return;
}
$this->msg = "Der Datensatz '$lk' konnte nicht gelöscht werden";
}
示例2: setData
/**
* set data
*/
public function setData()
{
$requestHelper = $this->controller->getRequestHelper();
$class = $requestHelper->getParam('class');
$viewMode = $requestHelper->getParam('mode');
if (!in_array($viewMode, array(DisplayClass::EDIT, DisplayClass::VIEW))) {
$viewMode = DisplayClass::VIEW;
}
$obj = Factory::loadObject($class, $requestHelper->getParam('LK'));
if (is_null($obj)) {
$obj = Factory::createObject($class);
}
$this->obj = $obj;
$user = Flat::user();
$dataPermission = DataPermission::createObject($obj);
if (!User::isLoggedIn() || !$user->isEntitled($obj->getPermissionForViewMode($viewMode)) || !$dataPermission->isUserOccupant($user->getLogicalKey())) {
$viewMode = DisplayClass::VIEW;
}
$formModel = new base_form_Model($obj, $viewMode);
$formModel->setAjaxForm('base_ajax_save_Controller');
$formModel->setMethod(base_form_Model::METHOD_POST);
$formModel->addAction("&class=$class");
$formModel->addAction("&caller=" . $this->controller->getCallerSection());
$formModel->setId('inputData');
$this->data = new base_form_View($formModel);
}
示例3: createPageIntro
public function createPageIntro()
{
$obj = $this->data[0];
$seller = Factory::loadObject('user', $obj['sellerId']);
$buyer = Factory::loadObject('user', $obj['firstEditor']);
$this->Cell(180, 15, 'Guten Tag ' . $seller['userid'], 0, 1, 'L');
$this->Cell(180, 7, 'Es wurden folgende Artikel von ' . $buyer['userid'] . ' gekauft.', 0, 1, 'L');
$this->Cell(180, 7, 'Bitte setzen Sie sich mit dem Käufer in Verbindung', 0, 1, 'L');
$this->Ln(15);
}
示例4: toExternal
public function toExternal($value)
{
$mnList = [];
foreach ($value as $baseConnObject) {
if (!$baseConnObject instanceof BaseConnectionObject) {
throw new BaseException('No BaseConnectionObject given');
}
$fieldToShow = $this->fi->getFieldsOfConnectedClass();
$class = $this->fi->getClass();
$class = $baseConnObject->getOtherClass($class);
$obj = Factory::loadObject($class, (int) $baseConnObject->getLKForClass($class));
$mnList[] = $obj[$fieldToShow];
}
if (empty($mnList)) {
return '';
}
return implode(', ', $mnList);
}
示例5: _validateNeededInformation
/**
* validates the given values for the properties
*
* @throws base_exception_BaseConnectionObject
*/
private function _validateNeededInformation()
{
$properties = ['classLeft', 'classRight', 'lkLeft', 'lkRight'];
foreach ($properties as $property) {
if (!isset($this->$property)) {
throw new base_exception_BaseConnectionObject(TMS(base_exception_BaseConnectionObject::PROPERTY_NOT_SET, array('property' => $property)));
}
}
if (is_null(Factory::loadObject($this->classLeft, $this->lkLeft))) {
throw new base_exception_BaseConnectionObject(TMS(base_exception_BaseConnectionObject::OBJECT_NOT_EXISTS, array('class' => $this->classLeft, 'lk' => $this->lkLeft)));
}
if (is_null(Factory::loadObject($this->classRight, $this->lkRight))) {
throw new base_exception_BaseConnectionObject(TMS(base_exception_BaseConnectionObject::OBJECT_NOT_EXISTS, array('class' => $this->classRight, 'lk' => $this->lkRight)));
}
$select = new base_database_statement_Select();
$table = DB::table($this->table);
$select->setTable($table);
$where = DB::where($table->getColumn('classLeft'), DB::term($this->classLeft));
$where->addAnd($table->getColumn('classRight'), DB::term($this->classRight));
$where->addAnd($table->getColumn('lkRight'), DB::term($this->lkRight));
$where->addAnd($table->getColumn('lkLeft'), DB::term($this->lkLeft));
$select->setWhere($where);
$result = $select->fetchDatabase();
if (!empty($result)) {
return self::SAVE_OBJECT_ALREADY_EXISTS;
}
return self::SAVE_VALIDATION_SUCCESSFULL;
}
示例6: _createObjectList
/**
* create an array with objects of the given class
*
* @param $lks
* @return array
*/
private function _createObjectList($lks)
{
$obj = [];
foreach ($lks as $lk) {
$obj[] = Factory::loadObject($this->class, $lk);
}
return $obj;
}
示例7: RequestHelper
base_ui_Site::startMainContent($od);
$od->addContent(Html::startTag('h3'));
$od->addContent('Eingabe eines Biete-Artikels');
$od->addContent(Html::endTag('h3'));
if (!User::isLoggedIn()) {
$od->addContent('Sie sind nicht eingeloggt');
} else {
$requestHelper = new RequestHelper();
$lk = $requestHelper->getParam('lk');
$medOffer = null;
if (!is_null($lk)) {
$medOffer = Factory::loadObject('medOffer', (int) $lk);
}
if (!$medOffer instanceof MedOffer) {
$medOffer = Factory::createObject('medOffer');
}
$form = new base_form_Model($medOffer, DisplayClass::EDIT);
$form->setAjaxForm('base_ajax_save_Controller');
$form->addAction('&class=MedOffer');
$form->setId('inputData');
$formView = new base_form_View($form);
$od->addContent($formView->showStartTag());
$od->addContent($formView->showBody());
$od->addContent($formView->showSubmit());
}
base_ui_Site::endMainContent($od);
示例8: _createBuyerMail
/**
* @param $seller
* @param $pdf
* @throws Exception
* @throws phpmailerException
*/
private function _createBuyerMail($buyer, medexchange_pdf_medorder_BuyerPDF $pdf)
{
$mail = new Mailer();
$mail->Subject = 'Sie haben Artikel gekauft';
$buyerObj = Factory::loadObject('user', $buyer);
$mail->Body = "Hallo " . $buyerObj['userid'] . "\n\n";
$mail->Body .= "es wurden Artikel von Ihnen gekauft. Bitte ueberpruefen Sie das Dokument im Anhang.\n\n";
$mail->Body .= "Mit freundlichen Gruessen \n\nIhr medEXchange-Team";
$mail->addAddress($buyerObj['email']);
$mail->addAttachment($pdf->getPath());
$mail->send();
}
示例9: RequestHelper
base_ui_Site::displayTop($od);
base_ui_Site::displayNavigation($od);
base_ui_Site::startMainContent($od);
$requestHelper = new RequestHelper();
$class = $requestHelper->getParam('class');
$viewMode = $requestHelper->getParam('mode');
if (is_null($class)) {
throw new base_exception_Site(TMS(base_exception_Site::PARAM_MISSING, array('param' => 'class')));
}
if (!in_array($viewMode, array(DisplayClass::EDIT, DisplayClass::VIEW))) {
$viewMode = DisplayClass::VIEW;
}
$obj = Factory::loadObject($class, $requestHelper->getParam('LK'));
if (is_null($obj)) {
$obj = Factory::createObject($class);
}
$user = Flat::user();
$dataPermission = DataPermission::createObject($obj);
if (!User::isLoggedIn() || !$user->isEntitled($obj->getPermissionForViewMode($viewMode)) || !$dataPermission->isUserOccupant($user->getLogicalKey())) {
$od->addContent('Sie verfügen nicht über die benötigten Rechte, um diese Datenkategorie zu bearbeiten. Bitte wenden Sie sich an den Support');
$viewMode = DisplayClass::VIEW;
}
$od->addContent(Html::startTag('h3'));
$od->addContent('Datenerfassung: ' . $obj->getDisplayName());
$od->addContent(Html::endTag('h3'));