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


PHP self::create方法代码示例

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


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

示例1: 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

示例2: add

 public static function add($data)
 {
     $model = new self();
     $data['pid'] = 0;
     $data['auth'] = ' ';
     return $model->create($data);
 }
开发者ID:Crocodile26,项目名称:php-1,代码行数:7,代码来源:Role.php

示例3: record

 public static function record($type, $user_id)
 {
     $active = new self();
     $active->user_id = $user_id;
     $active->type = $type;
     $active->create();
 }
开发者ID:sysatom,项目名称:workflow,代码行数:7,代码来源:UserActive.php

示例4: createSupportGroup

 /**
  * Wrapper for creating a support group.
  * It will check if the support group doesn't exist yet, if the tag or name already exists then NAME_TAKEN  or TAG_TAKEN will be returned.
  * If the name is bigger than 20 characters or smaller than 4 and the tag greater than 7 or smaller than 2 a SIZE_ERROR will be returned.
  * Else it will return SUCCESS
  * @return a string that specifies if it was a success or not (SUCCESS, SIZE_ERROR, NAME_TAKEN or TAG_TAKEN )
  */
 public static function createSupportGroup($name, $tag, $groupemail, $imap_mailserver, $imap_username, $imap_password)
 {
     //error_log( "Error at line " . __LINE__ . " in file " . __FILE__);
     if (strlen($name) <= 21 && strlen($name) >= 4 && strlen($tag) <= 8 && strlen($tag) >= 2) {
         $notExists = self::supportGroup_EntryNotExists($name, $tag);
         //error_log( "Error at line " . __LINE__ . " in file " . __FILE__);
         if ($notExists == "SUCCESS") {
             $sGroup = new self();
             $values = array('Name' => $name, 'Tag' => $tag, 'GroupEmail' => $groupemail, 'IMAP_MailServer' => $imap_mailserver, 'IMAP_Username' => $imap_username, 'IMAP_Password' => $imap_password);
             $sGroup->setName($values['Name']);
             $sGroup->setTag($values['Tag']);
             $sGroup->setGroupEmail($values['GroupEmail']);
             $sGroup->setIMAP_MailServer($values['IMAP_MailServer']);
             $sGroup->setIMAP_Username($values['IMAP_Username']);
             //encrypt password!
             global $cfg;
             $crypter = new MyCrypt($cfg['crypt']);
             $enc_password = $crypter->encrypt($values['IMAP_Password']);
             $sGroup->setIMAP_Password($enc_password);
             $sGroup->create();
             //error_log( "Error at line " . __LINE__ . " in file " . __FILE__);
         } else {
             //error_log( "Error at line " . __LINE__ . " in file " . __FILE__);
             //return NAME_TAKEN  or TAG_TAKEN
             return $notExists;
         }
     } else {
         //error_log( "Error at line " . __LINE__ . " in file " . __FILE__);
         //RETURN ERROR that indicates SIZE
         return "SIZE_ERROR";
     }
 }
开发者ID:ryzom,项目名称:ryzomcore,代码行数:39,代码来源:support_group.php

示例5: 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

示例6: add

 public static function add($data)
 {
     $model = new self();
     unset($data['repassword']);
     $data['status'] = 1;
     return $model->create($data);
 }
开发者ID:Crocodile26,项目名称:php-1,代码行数:7,代码来源:Operator.php

示例7: render

 /**
  * @param string          $format
  * @param OutputInterface $output
  * @param array           $rows
  */
 public static function render($format, OutputInterface $output, array $rows)
 {
     $factory = new self();
     if (!($renderer = $factory->create($format))) {
         throw new InvalidArgumentException(sprintf('Unknown format %s, known formats are: %s', var_export($format)), implode(',', self::getFormats()));
     }
     $renderer->render($output, $rows);
 }
开发者ID:jsiefer,项目名称:n98-magerun,代码行数:13,代码来源:RendererFactory.php

示例8: getObjectManager

 /**
  * Get MTF Object Manager instance
  *
  * @return ObjectManager
  */
 public static function getObjectManager()
 {
     if (!($objectManager = ObjectManager::getInstance())) {
         $objectManagerFactory = new self();
         $objectManager = $objectManagerFactory->create();
     }
     return $objectManager;
 }
开发者ID:vasiljok,项目名称:magento2,代码行数:13,代码来源:ObjectManagerFactory.php

示例9: get

 public static function get()
 {
     if (!isset(self::$driver)) {
         $i = new self();
         self::$driver = $i->create();
     }
     return self::$driver;
 }
开发者ID:fliglio,项目名称:borg,代码行数:8,代码来源:MockCollectiveDriverFactory.php

示例10: add

 public static function add($params)
 {
     $handle = new self();
     foreach ($params as $key => $value) {
         $handle->{$key} = $value;
     }
     $handle->create($params);
 }
开发者ID:Oogieboogie23,项目名称:Division-Tracker,代码行数:8,代码来源:MemberHandle.php

示例11: instance

 /**
  * @return \Doctrine\ORM\EntityManager
  */
 public static function instance()
 {
     if (is_null(self::$entityManagerInstance)) {
         $entityManager = new self();
         self::$entityManagerInstance = $entityManager->create();
     }
     return self::$entityManagerInstance;
 }
开发者ID:kohana,项目名称:doctrine,代码行数:11,代码来源:EntityManager.php

示例12: createOrUpdate

 public static function createOrUpdate($siteId, $links)
 {
     // dd( $links );
     $links->filter(function ($link) use($siteId) {
         return self::isSameHost($link, $siteId);
     })->each(function ($link) use($siteId) {
         $saveWebpage = new self();
         $saveWebpage->create($siteId, $link);
     });
 }
开发者ID:SimZal,项目名称:laracrawl,代码行数:10,代码来源:SaveWebpage.php

示例13: set

 /**
  * @param $name
  * @param $value
  */
 public static function set($name, $value)
 {
     $obj = new self($name);
     $obj->setValue($value);
     if (self::where(array('name' => $name))->hasSets()) {
         $obj->update();
     } else {
         $obj->create();
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:14,代码来源:class.arConfig.php

示例14: createFromCollection

 /**
  * Batch create of properties from variables array
  * @param VariableCollection $variableCollection Array of variable definition
  * @return array Array of created properties
  */
 public static function createFromCollection(VariableCollection $variableCollection)
 {
     $properties = [];
     /** @var Variable $variable */
     foreach ($variableCollection as $variable) {
         $property = new self($variable->getName(), $variable->getType(), $variable->getVisibility());
         $properties[] = $property->create();
     }
     return $properties;
 }
开发者ID:gefud,项目名称:gefud,代码行数:15,代码来源:EntityPropertyGenerator.php

示例15: createSubFolders

 private function createSubFolders()
 {
     $ok = true;
     foreach ($this->subFolders as $folder) {
         $dir = new self($this->getPath() . $folder);
         if (!$dir->create()) {
             $ok = false;
         }
     }
     return $ok;
 }
开发者ID:sergiowebmaster,项目名称:CleanCode,代码行数:11,代码来源:CleanCodeDir.php


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