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


PHP self::getId方法代码示例

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


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

示例1: get

 /**
  * @param string $key
  * @param boolean $returnObject
  * @return mixed|null
  */
 public static function get($key, $returnObject = FALSE)
 {
     $cacheKey = $key . '~~~';
     if (array_key_exists($cacheKey, self::$nameIdMappingCache)) {
         $entry = self::getById(self::$nameIdMappingCache[$cacheKey]);
         if ($returnObject) {
             return $entry;
         }
         return $entry instanceof Configuration ? $entry->getData() : NULL;
     }
     $configurationEntry = new self();
     try {
         $configurationEntry->getDao()->getByKey($key);
     } catch (\Exception $e) {
         return NULL;
     }
     if ($configurationEntry->getId() > 0) {
         self::$nameIdMappingCache[$cacheKey] = $configurationEntry->getId();
         $entry = self::getById($configurationEntry->getId());
         if ($returnObject) {
             return $entry;
         }
         return $entry instanceof Configuration ? $entry->getData() : NULL;
     }
 }
开发者ID:dachcom-digital,项目名称:pimcore-lucene-search,代码行数:30,代码来源:Configuration.php

示例2: createFromExercise

 /**
  * Import relevant properties from given exercise
  *
  * @param ilObjExercise $a_test
  * @return object
  */
 public static function createFromExercise(ilObjExercise $a_exercise, $a_user_id)
 {
     global $lng;
     $lng->loadLanguageModule("exercise");
     $newObj = new self();
     $newObj->setTitle($a_exercise->getTitle());
     $newObj->setDescription($a_exercise->getDescription());
     include_once "Services/Tracking/classes/class.ilLPMarks.php";
     $lp_marks = new ilLPMarks($a_exercise->getId(), $a_user_id);
     $newObj->setProperty("issued_on", new ilDate($lp_marks->getStatusChanged(), IL_CAL_DATETIME));
     // create certificate
     include_once "Services/Certificate/classes/class.ilCertificate.php";
     include_once "Modules/Exercise/classes/class.ilExerciseCertificateAdapter.php";
     $certificate = new ilCertificate(new ilExerciseCertificateAdapter($a_exercise));
     $certificate = $certificate->outCertificate(array("user_id" => $a_user_id), false);
     // save pdf file
     if ($certificate) {
         // we need the object id for storing the certificate file
         $newObj->create();
         $path = self::initStorage($newObj->getId(), "certificate");
         $file_name = "exc_" . $a_exercise->getId() . "_" . $a_user_id . ".pdf";
         if (file_put_contents($path . $file_name, $certificate)) {
             $newObj->setProperty("file", $file_name);
             $newObj->update();
             return $newObj;
         }
         // file creation failed, so remove to object, too
         $newObj->delete();
     }
     // remove if certificate works
     $newObj->create();
     return $newObj;
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:39,代码来源:class.ilObjExerciseVerification.php

示例3: createFromTest

 /**
  * Import relevant properties from given test
  *
  * @param ilObjTest $a_test
  * @return object
  */
 public static function createFromTest(ilObjTest $a_test, $a_user_id)
 {
     global $lng;
     $lng->loadLanguageModule("wsp");
     $newObj = new self();
     $newObj->setTitle($lng->txt("wsp_type_tstv") . " \"" . $a_test->getTitle() . "\"");
     $newObj->setDescription($a_test->getDescription());
     $active_id = $a_test->getActiveIdOfUser($a_user_id);
     $pass = ilObjTest::_getResultPass($active_id);
     $date = $a_test->getPassFinishDate($active_id, $pass);
     $newObj->setProperty("issued_on", new ilDate($date, IL_CAL_UNIX));
     // create certificate
     include_once "Services/Certificate/classes/class.ilCertificate.php";
     include_once "Modules/Test/classes/class.ilTestCertificateAdapter.php";
     $certificate = new ilCertificate(new ilTestCertificateAdapter($a_test));
     $certificate = $certificate->outCertificate(array("active_id" => $active_id, "pass" => $pass), false);
     // save pdf file
     if ($certificate) {
         // we need the object id for storing the certificate file
         $newObj->create();
         $path = self::initStorage($newObj->getId(), "certificate");
         $file_name = "tst_" . $a_test->getId() . "_" . $a_user_id . "_" . $active_id . ".pdf";
         if (file_put_contents($path . $file_name, $certificate)) {
             $newObj->setProperty("file", $file_name);
             $newObj->update();
             return $newObj;
         }
         // file creation failed, so remove to object, too
         $newObj->delete();
     }
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:37,代码来源:class.ilObjTestVerification.php

示例4: add

 /**
  * @param Uuid $id
  * @param AddAuthor[] $authors
  * @param string $title
  * @param string $isbn
  * @return Book
  */
 public static function add(Uuid $id, array $authors, $title, $isbn)
 {
     $instance = new self($id);
     $authorsAdded = array_map(function (AddAuthor $author) use($instance) {
         $authorAdded = new AuthorAdded($instance->id, $author->getFirstName(), $author->getLastName());
         $instance->applyAuthorAdded($authorAdded);
         return $authorAdded;
     }, $authors);
     $instance->applyChange(new BookAdded($instance->getId(), $authorsAdded, $title, $isbn));
     return $instance;
 }
开发者ID:EightArmCode,项目名称:librarian,代码行数:18,代码来源:Book.php

示例5: mount

 /**
  * Mount a Mux or a Controller object on a specific path.
  *
  * @param string         $pattern
  * @param Mux|Controller $mux
  * @param array          $options
  */
 public function mount($pattern, $mux, array $options = array())
 {
     if ($mux instanceof Controller) {
         $mux = $mux->expand();
     } elseif ($mux instanceof Closure) {
         // we pass newly created Mux object to the closure to let it initialize it.
         if ($ret = $mux($mux = new self())) {
             if ($ret instanceof self) {
                 $mux = $ret;
             } else {
                 throw new LogicException('Invalid object returned from Closure.');
             }
         }
     } elseif ((!is_object($mux) || !$mux instanceof self) && is_callable($mux)) {
         $mux($mux = new self());
     }
     $muxId = $mux->getId();
     $this->add($pattern, $muxId, $options);
     $this->submux[$muxId] = $mux;
     /*
     if ($this->expand) {
         $pcre = strpos($pattern,':') !== false;
     
         // rewrite submux routes
         foreach ($mux->routes as $route) {
             // process for pcre
             if ( $route[0] || $pcre ) {
                 $newPattern = $pattern . ( $route[0] ? $route[3]['pattern'] : $route[1] );
                 $routeArgs = PatternCompiler::compile($newPattern, 
                     array_replace_recursive($options, $route[3]) );
                 $this->appendPCRERoute( $routeArgs, $route[2] );
             } else {
                 $this->routes[] = array(
                     false,
                     $pattern . $route[1],
                     $route[2],
                     isset($route[3]) ? array_replace_recursive($options, $route[3]) : $options,
                 );
             }
         }
     */
 }
开发者ID:kpb90,项目名称:Pux,代码行数:49,代码来源:Mux.php

示例6: checkPassword

 public static function checkPassword($user, $login, $password)
 {
     if (is_null($user)) {
         $user = new self();
         $user->profile_id = $login;
     }
     $ldap = new MyLdap($login, $password);
     if ($ldap->isUser()) {
         $userData = $ldap->searchUser();
         $user->fullname = $userData['name_ru'];
         $user->email = $userData['email'];
         $new = $user->isNewRecord;
         if ($user->save()) {
             if ($new) {
                 $auth = Yii::$app->authManager;
                 $auth->assign($auth->getRole('guest'), $user->getId());
             }
             return true;
         }
     }
     return false;
 }
开发者ID:igribov,项目名称:question-list,代码行数:22,代码来源:User.php

示例7: getInstance

 /**
  * retrieve metafolder instance by either primary key of db entry
  * or path - both relative and absolute paths are allowed
  *
  * @return MetaFolder
  */
 public static function getInstance($path = NULL, $id = NULL)
 {
     if (isset($path)) {
         $path = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
         $lookup = Application::getInstance()->extendToAbsoluteAssetsPath($path);
         if (!isset(self::$instancesByPath[$lookup])) {
             $mf = new self($path);
             self::$instancesByPath[$mf->getFullPath()] = $mf;
             self::$instancesById[$mf->getId()] = $mf;
         }
         return self::$instancesByPath[$lookup];
     } else {
         if (isset($id)) {
             if (!isset(self::$instancesById[$id])) {
                 $mf = new self(NULL, $id);
                 self::$instancesById[$id] = $mf;
                 self::$instancesByPath[$mf->getFullPath()] = $mf;
             }
             return self::$instancesById[$id];
         } else {
             throw new MetaFolderException("Either folder id or path required.", MetaFolderException::ID_OR_PATH_REQUIRED);
         }
     }
 }
开发者ID:vectrex,项目名称:vxphp,代码行数:30,代码来源:MetaFolder.php

示例8: createFromSCORMLM

 /**
  * Import relevant properties from given learning module
  *
  * @param ilObjSAHSLearningModule $a_lm
  * @return object
  */
 public static function createFromSCORMLM(ilObjSAHSLearningModule $a_lm, $a_user_id)
 {
     global $lng;
     $lng->loadLanguageModule("sahs");
     $newObj = new self();
     $newObj->setTitle($a_lm->getTitle());
     $newObj->setDescription($a_lm->getDescription());
     include_once "Services/Tracking/classes/class.ilLPMarks.php";
     $lp_marks = new ilLPMarks($a_lm->getId(), $a_user_id);
     $newObj->setProperty("issued_on", new ilDate($lp_marks->getStatusChanged(), IL_CAL_DATETIME));
     // create certificate
     if (!stristr(get_class($a_lm), "2004")) {
         $last_access = ilObjSCORMLearningModule::_lookupLastAccess($a_lm->getId(), $a_user_id);
     } else {
         $last_access = ilObjSCORM2004LearningModule::_lookupLastAccess($a_lm->getId(), $a_user_id);
     }
     $params = array("user_data" => ilObjUser::_lookupFields($a_user_id), "last_access" => $last_access);
     include_once "Services/Certificate/classes/class.ilCertificate.php";
     include_once "Modules/ScormAicc/classes/class.ilSCORMCertificateAdapter.php";
     $certificate = new ilCertificate(new ilSCORMCertificateAdapter($a_lm));
     $certificate = $certificate->outCertificate($params, false);
     // save pdf file
     if ($certificate) {
         // we need the object id for storing the certificate file
         $newObj->create();
         $path = self::initStorage($newObj->getId(), "certificate");
         $file_name = "sahs_" . $a_lm->getId() . "_" . $a_user_id . ".pdf";
         if (file_put_contents($path . $file_name, $certificate)) {
             $newObj->setProperty("file", $file_name);
             $newObj->update();
             return $newObj;
         }
         // file creation failed, so remove to object, too
         $newObj->delete();
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:42,代码来源:class.ilObjSCORMVerification.php

示例9: deleteAllDeliveredFilesOfUser

 /**
  * Delete all delivered files of user
  *
  * @param int $a_exc_id excercise id
  * @param int $a_user_id user id
  */
 static function deleteAllDeliveredFilesOfUser($a_exc_id, $a_user_id)
 {
     global $ilDB;
     include_once "./Modules/Exercise/classes/class.ilFSStorageExercise.php";
     $delete_ids = array();
     // get the files and...
     $set = $ilDB->query("SELECT * FROM exc_returned " . " WHERE obj_id = " . $ilDB->quote($a_exc_id, "integer") . " AND user_id = " . $ilDB->quote($a_user_id, "integer"));
     while ($rec = $ilDB->fetchAssoc($set)) {
         $ass = new self($rec["ass_id"]);
         if ($ass->getType() == self::TYPE_UPLOAD_TEAM) {
             // switch upload to other team member
             $team = self::getTeamMembersByAssignmentId($ass->getId(), $a_user_id);
             if (sizeof($team) > 1) {
                 $new_owner = array_pop($team);
                 while ($new_owner == $a_user_id && sizeof($team)) {
                     $new_owner = array_pop($team);
                 }
                 $ilDB->manipulate("UPDATE exc_returned" . " SET user_id = " . $ilDB->quote($new_owner, "integer") . " WHERE returned_id = " . $ilDB->quote($rec["returned_id"], "integer"));
                 // no need to delete
                 continue;
             }
         }
         $delete_ids[] = $rec["returned_id"];
         $fs = new ilFSStorageExercise($a_exc_id, $rec["ass_id"]);
         // ...delete files
         $filename = $fs->getAbsoluteSubmissionPath() . "/" . $a_user_id . "/" . basename($rec["filename"]);
         if (is_file($filename)) {
             unlink($filename);
         }
     }
     // delete exc_returned records
     if ($delete_ids) {
         $ilDB->manipulate("DELETE FROM exc_returned" . " WHERE " . $ilDB->in("returned_id", $delete_ids, "", "integer"));
     }
     // delete il_exc_team records
     $ass_ids = array();
     foreach (self::getAssignmentDataOfExercise($a_exc_id) as $item) {
         $ass_ids[] = $item["id"];
     }
     if ($ass_ids) {
         $ilDB->manipulate($d = "DELETE FROM il_exc_team WHERE " . "user_id = " . $ilDB->quote($a_user_id, "integer") . " AND " . $ilDB->in("ass_id", $ass_ids, "", "integer"));
     }
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:49,代码来源:class.ilExAssignment.php

示例10: start

 public static function start($size)
 {
     $self = new self();
     return "<div class=\"col-md-{$size}\" id=\"{$self->getId()}\">";
 }
开发者ID:nkammah,项目名称:Crash-Analytics,代码行数:5,代码来源:Column.php

示例11: getByName

 /**
  * @param string $name
  * @return self
  */
 public static function getByName($name)
 {
     $class = new self();
     try {
         $class->getDao()->getByName($name);
     } catch (\Exception $e) {
         \Logger::error($e);
         return null;
     }
     // to have a singleton in a way. like all instances of Element\ElementInterface do also, like Object\AbstractObject
     if ($class->getId() > 0) {
         return self::getById($class->getId());
     }
 }
开发者ID:ptaferner,项目名称:pimcore,代码行数:18,代码来源:ClassDefinition.php

示例12: doClone

 public function doClone($a_pool_id, $a_schedule_map = null)
 {
     $new_obj = new self();
     $new_obj->setPoolId($a_pool_id);
     $new_obj->setTitle($this->getTitle());
     $new_obj->setDescription($this->getDescription());
     $new_obj->setNrOfItems($this->getNrOfItems());
     $new_obj->setFile($this->getFile());
     $new_obj->setPostText($this->getPostText());
     $new_obj->setPostFile($this->getPostFile());
     if ($a_schedule_map) {
         $schedule_id = $this->getScheduleId();
         if ($schedule_id) {
             $new_obj->setScheduleId($a_schedule_map[$schedule_id]);
         }
     }
     $new_obj->save();
     // files
     $source = $this->initStorage($this->getId());
     $target = $new_obj->initStorage($new_obj->getId());
     ilUtil::rCopy($source, $target);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:22,代码来源:class.ilBookingObject.php

示例13: getByPath

 /**
  * @param string $path
  * @return Object_Abstract
  */
 public static function getByPath($path)
 {
     $path = Element_Service::correctPath($path);
     try {
         $object = new self();
         if (Pimcore_Tool::isValidPath($path)) {
             $object->getResource()->getByPath($path);
             return self::getById($object->getId());
         }
     } catch (Exception $e) {
         Logger::warning($e);
     }
     return null;
 }
开发者ID:nblackman,项目名称:pimcore,代码行数:18,代码来源:Abstract.php

示例14: updateAgent

 public static function updateAgent()
 {
     $engine = new self();
     if ($engine->getAuthSettings()) {
         try {
             $dbRes = YandexCampaignTable::getList(array('filter' => array('<LAST_UPDATE' => DateTime::createFromTimestamp(time() - YandexCampaignTable::CACHE_LIFETIME), '=ENGINE_ID' => $engine->getId()), 'select' => array('CNT'), 'runtime' => array(new ExpressionField('CNT', 'COUNT(*)'))));
             $res = $dbRes->fetch();
             if ($res['CNT'] > 0) {
                 $engine->updateCampaignManual();
             }
             $availableCampaigns = array();
             $campaignList = $engine->getCampaignList();
             foreach ($campaignList as $campaignInfo) {
                 $availableCampaigns[] = $campaignInfo['CampaignID'];
             }
             if (count($availableCampaigns) > 0) {
                 $dbRes = YandexBannerTable::getList(array('group' => array('CAMPAIGN_ID'), 'filter' => array('<LAST_UPDATE' => DateTime::createFromTimestamp(time() - YandexBannerTable::CACHE_LIFETIME), '=ENGINE_ID' => $engine->getId(), '=CAMPAIGN.XML_ID' => $availableCampaigns), 'select' => array('CAMPAIGN_ID')));
                 $campaignId = array();
                 while ($res = $dbRes->fetch()) {
                     $campaignId[] = $res['CAMPAIGN_ID'];
                 }
                 if (count($campaignId) > 0) {
                     $engine->updateBannersManual($campaignId);
                 }
             }
         } catch (YandexDirectException $e) {
         }
     }
     return __CLASS__ . "::updateAgent();";
 }
开发者ID:Satariall,项目名称:izurit,代码行数:30,代码来源:yandexdirect.php

示例15: getIdFromConnection

 /**
  * Return id of connection context for connection.
  *
  * @param ConnectionInterface $conn
  *
  * @return string
  */
 public static function getIdFromConnection(ConnectionInterface $conn)
 {
     $context = new self($conn);
     return $context->getId();
 }
开发者ID:sulu,项目名称:sulu,代码行数:12,代码来源:ConnectionContext.php


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