当前位置: 首页>>代码示例>>PHP>>正文


PHP Factory::createObject方法代码示例

本文整理汇总了PHP中Factory::createObject方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::createObject方法的具体用法?PHP Factory::createObject怎么用?PHP Factory::createObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Factory的用法示例。


在下文中一共展示了Factory::createObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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);
    }
开发者ID:kafruhs,项目名称:fws,代码行数:33,代码来源:BaseObject.php

示例2: getWriteDisplay

 /**
  * show the data in an input element for editing
  *
  * @return string
  */
 protected function getWriteDisplay()
 {
     $selectedOptionNames = explode(', ', $this->value);
     $output = Html::startTag('div', ['class' => $this->class]);
     $connectedClassName = $this->fieldinfo->getConnectedClass();
     /** @var BaseConnectionObject $connObj */
     $connObj = new $connectedClassName();
     $class = $connObj->getOtherClass($this->fieldinfo->getClass());
     $obj = Factory::createObject($class);
     $connectedFieldName = $this->fieldinfo->getFieldsOfConnectedClass();
     $table = DB::table($obj->getTable());
     $result = Finder::create($class)->find([$table->getColumn($connectedFieldName), $table->getColumn('LK')]);
     foreach ($result as $row) {
         $params = [];
         $params['value'] = $row['LK'];
         $params['type']  = 'checkbox';
         $params['class'] = 'checkbox';
         $params['name']  = $this->name . '[]';
         if (in_array($row[$connectedFieldName], $selectedOptionNames)) {
             $params['checked'] = 'checked';
         }
         $output .= Html::startTag('p') . Html::singleTag('input', $params) . " " . $row[$connectedFieldName] . Html::endTag('p');
     }
     $output .= Html::endTag('div');
     return $output;
 }
开发者ID:kafruhs,项目名称:fws,代码行数:31,代码来源:MnConnection.php

示例3: classNameInstanceOfBaseObject

 public static function classNameInstanceOfBaseObject($className)
 {
     $obj = Factory::createObject($className);
     if ($obj instanceof BaseObject === false) {
         throw new BaseException(TMS(BaseException::CLASS_NOT_INSTANCEOF_BASOBJECT, array('class' => $className)));
     }
 }
开发者ID:kafruhs,项目名称:fws,代码行数:7,代码来源:Check.php

示例4: setData

 /**
  * set data
  */
 public function setData()
 {
     $obj = Factory::createObject('News');
     $table = DB::table($obj->getTable());
     $limit = new base_database_Limit(10);
     $order = DB::order($table->getColumn('firstEditTime'));
     $finder = Finder::create('news')->setOrder($order)->setlimit($limit);
     $this->data = $finder->find();
 }
开发者ID:kafruhs,项目名称:fws,代码行数:12,代码来源:Model.php

示例5: mapFieldValue

 public function mapFieldValue($value)
 {
     $obj = Factory::createObject('vendor');
     $table = DB::table($obj->getTable());
     $where = DB::where($table->getColumn('name'), DB::term($value));
     $finder = Finder::create('vendor')->setWhere($where);
     $result = $finder->find(array($table->getColumn('LK')));
     if (count($result) > 1) {
         throw new base_exception_Mapper(TMS('medexchange.exception.mapper.vendorDuplicatedEntry'));
     }
     $lkArray = $result[0];
     return $lkArray['LK'];
 }
开发者ID:kafruhs,项目名称:fws,代码行数:13,代码来源:FKVendor.php

示例6: fromDBToExternal

    public function fromDBToExternal($value)
    {
        $obj = Factory::createObject($this->fi->getConnectedClass());
        $select = new base_database_statement_Select();
        $table = DB::table($obj->getTable());
        $where = DB::where($table->getColumn('LK'), DB::intTerm((int) $value));
        $select->setTable($table);
        $select->setWhere($where);
        $select->setColumns(array($table->getColumn($this->fi->getFieldsOfConnectedClass())));
        $result = $select->fetchDatabase();
        $value = current($result);
        return $value[$this->fi->getFieldsOfConnectedClass()];

    }
开发者ID:kafruhs,项目名称:fws,代码行数:14,代码来源:Lk.php

示例7: loadEntriesForCategory

 public function loadEntriesForCategory($catLK)
 {
     $navEntry = Factory::createObject('NavigationEntry');
     $table = DB::table($navEntry->getTable());
     $where = DB::where($table->getColumn('category'), DB::intTerm($catLK));
     $entries = Finder::create('navigationEntry')->setWhere($where)->find();
     $relevantEntries = [];
     foreach ($entries as $entry) {
         if ($this->_isEntitledForEntry($entry)) {
             $relevantEntries[] = $entry;
         }
     }
     return $relevantEntries;
 }
开发者ID:kafruhs,项目名称:fws,代码行数:14,代码来源:Navigation.php

示例8: mapFieldValue

    /**
     * converts a given value to the specified structure
     *
     * @param $value
     * @return mixed
     * @throws base_database_Exception
     * @throws base_exception_Mapper
     */
    public function mapFieldValue($value)
    {
        $obj = Factory::createObject('TSMCollocgroup');
        $table = DB::table($obj->getTable());
        $where = DB::where($table->getColumn('name'), DB::term($value));
        $where->addAnd($table->getColumn('FK_tsmserver'), DB::term(TSMServerManager::get()->getActualTsmServerLK()));
        $finder = Finder::create('TSMCollocgroup')->setWhere($where);
        $result = $finder->find(array($table->getColumn('LK')));

        if (count($result) > 1) {
            throw new base_exception_Mapper(TMS('tsmviewer.exception.mapper.collocgroupDuplicatedEntry'));
        }

        $lkArray = current($result);

        return $lkArray['LK'];
    }
开发者ID:kafruhs,项目名称:fws,代码行数:25,代码来源:FKcollocgroup.php

示例9: getData

 protected function getData()
 {
     $requestHelper = $this->controller->getRequestHelper();
     $pzn = $requestHelper->getParam('pzn');
     $obj = Factory::createObject('medicament');
     $table = DB::table($obj->getTable());
     $where = DB::where($table->getColumn('pzn'), DB::term($pzn));
     $finder = Finder::create('medicament')->setWhere($where);
     $result = $finder->find();
     if (empty($result)) {
         return array();
     }
     /** @var BaseObject $obj */
     $obj = $result[0];
     foreach ($obj->getAllFields() as $fi) {
         if ($fi->getDisplayClass() == 'system') {
             continue;
         }
         $values[$fi->getFieldName()] = $obj->getField($fi->getFieldName());
     }
     return $values;
 }
开发者ID:kafruhs,项目名称:fws,代码行数:22,代码来源:Model.php

示例10: user

    /**
     * get the actual logged in User
     *
     * @return User|null
     */
    public static function user()
    {
        if (isset($GLOBALS['argv'])) {
            if (isset($GLOBALS['user'])) {
                return $GLOBALS['user'];
            }
            $GLOBALS['user'] = new User();
            $GLOBALS['user']->load(1);
            return $GLOBALS['user'];
        }

        if (!User::isLoggedIn()) {
            return Factory::createObject('User');
        }

        $user = $_SESSION['user'];

        if (! $user instanceof User) {
            return Factory::createObject('user');
        }
        return $user;
    }
开发者ID:kafruhs,项目名称:fws,代码行数:27,代码来源:Flat.php

示例11: executeRequest

    /**
     * execute the actual ajax request
     */
    protected function executeRequest()
    {
        $requestHelper = $this->controller->getRequestHelper();
        $class = $requestHelper->getParam('class');
        $object = Factory::createObject($class);
        /** @var BaseObject[] $result */
        $result = Finder::create($class)->find();
        $urlColumns = $requestHelper->getParam('cols');

        if (!is_null($urlColumns)) {
            if ($urlColumns == 'all') {
                $fi = new Fieldinfo($class);
                $columnNames = $fi->getAllFieldNames();
            } else {
                $columnNames = explode(',', $urlColumns);
            }
        } else {
            $columnNames = $object->getStdSearchColumns();
        }

        $response = new stdClass();


        $i = 0;
        foreach ($result as $obj) {
            $values = [];
            $values['LK'] = (int) $obj['LK'];
            foreach ($columnNames as $colName) {
                $values[$colName] = $obj->getField($colName);
            }

            $response->BaseObjectReader[] = $values;
            $i++;
        }
        $jsonObject = json_encode($response);
        echo $jsonObject;
        exit();
    }
开发者ID:kafruhs,项目名称:fws,代码行数:41,代码来源:Model.php

示例12: login

    /**
     * login of an user with the given userid and password
     *
     * @param string $userid
     * @param string $password
     *
     * @return int
     * @throws base_database_Exception
     */
    public static function login($userid, $password)
    {
        $table = DB::table(Factory::createObject('user')->getTable());
        $where = DB::where($table->getColumn('userid'), DB::stringTerm($userid));
        $res = Finder::create('user')->setWhere($where)->find();

        if (empty($res)) {
            return self::LOGIN_FAILURE;
        }
        $user = current($res);
        if ($user['disabled'] == self::USER_DISABLED) {
            return self::LOGIN_USER_DISABLED;
        }
        if ($user['password'] != md5($password)) {
            return self::_updateLoginTries($table, $user);
        }

        try {
            $time = new base_date_model_DateTime();
            $updateData = array(
                'ip' => DB::stringTerm($_SERVER['REMOTE_ADDR']),
                'sessionid' => DB::stringTerm(session_id()),
                'lastLogin' => DB::stringTerm($time->toDB()),
                'loginTries' => DB::intTerm(0),
            );
            self::_updateUserLoginData($table, $where, $updateData);
        } catch (Exception $e) {
            return self::LOGIN_FAILURE;
        }
        $user['ip'] = $_SERVER['REMOTE_ADDR'];
        $user['sessionid'] = session_id();
        $user['lastLogin'] = $time;
        $user['loginTries'] = 0;
        $_SESSION['user'] = $user;

        return self::LOGIN_SUCCESS;
    }
开发者ID:kafruhs,项目名称:fws,代码行数:46,代码来源:User.php

示例13: __construct

 /**
  * @param string $className
  */
 protected function __construct($className)
 {
     $obj = Factory::createObject($className);
     $this->class = $className;
     $this->table = DB::table($obj->getTable());
 }
开发者ID:kafruhs,项目名称:fws,代码行数:9,代码来源:Finder.php

示例14: Output

    public function Output($name = 'doc.pdf', $dest = 'F', $description = '')
    {
        DB::beginTransaction();
        $file = Factory::createObject('file');
        $path = ROOT . "/files/order/" . $name;
        $file['name'] = $name;
        $file['link'] = HTML_ROOT . '/files/order/' . $name;
        $obj = $this->data[0];
        if (empty($description)) {
            $description = "PDF vom " . date("d.m.Y H:i:s", time()) . " Uhr zur Objekt-Klasse " . get_class($obj);
        }
        $file['description'] = $description;

        $file->save();
        DB::endTransaction();

        parent::Output($path, $dest);
        $this->path = $path;
    }
开发者ID:kafruhs,项目名称:fws,代码行数:19,代码来源:PDFCreator.php

示例15: ucfirst

                $formElement->setName($fi->getFieldName());
                $formElement->setValue($obj->getField($fi->getFieldName()));
                $displayClassName = 'base_displayclass_' . ucfirst($fi->getDisplayClass());
                /** @var DisplayClass $dpC */
//                $dpC = new $displayClassName($obj);
//                $displayMode = $dpC->getDisplayMode(DisplayClass::VIEW);
                $formElement->setDisplayMode(DisplayClass::VIEW);
                $cell = new base_html_model_table_Cell();
                $cell->setCssID($fi->getFieldName());
                $cell->setCssClass($formElement->getClass());
                $cell->setContent($formElement->display());
                $row->addCell($cell);
            }
            $cell = new base_html_model_table_Cell();
            $cell->setCssClass('orderAmount');
            $medOrder = Factory::createObject('MedOrder');
            $fi = $medOrder->getFieldinfo('amount');
            $formElement = base_form_element_Factory::createElement($fi);
            $formElement->setClass($formElement->getClass() . ' orderAmount');
            $formElement->setMultiline();
            $formElement->setName('orderAmount');
            $formElement->setValue(0);
            $formElement->setDisplayMode(DisplayClass::EDIT);
            $content = $formElement->display();
            $formElement = new base_form_element_Hidden($obj->getFieldinfo('LK'));
            $formElement->setMultiline();
            $formElement->setName('LK');
            $value = $obj['LK'];
            $formElement->setValue($value);
            $content .= " " . $formElement->display();
            $cell->setContent($content);
开发者ID:kafruhs,项目名称:fws,代码行数:31,代码来源:offer.php


注:本文中的Factory::createObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。