當前位置: 首頁>>代碼示例>>PHP>>正文


PHP self::delete方法代碼示例

本文整理匯總了PHP中self::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP self::delete方法的具體用法?PHP self::delete怎麽用?PHP self::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在self的用法示例。


在下文中一共展示了self::delete方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

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

示例2: fromArray

 /**
  * Creates a zipper from an array, with a hole in the
  * 0-index position.
  * @param Array to zipper-ify.
  * @return Tuple of zipper and element of first position.
  */
 public static function fromArray($array)
 {
     $z = new self(array(), array_reverse($array));
     $t = $z->delete();
     // delete the "dummy hole"
     return array($z, $t);
 }
開發者ID:ajnok,項目名稱:yii2book,代碼行數:13,代碼來源:Zipper.php

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

示例4: mark

 public static function mark(GWF_User $user, GWF_Links $link, $bool)
 {
     $userid = $user->getID();
     $linkid = $link->getID();
     $is_fav = self::table(__CLASS__)->getRow($userid, $linkid) !== false;
     if ($is_fav === $bool) {
         return true;
     }
     $row = new self(array('lf_uid' => $userid, 'lf_lid' => $linkid));
     if ($bool) {
         if (!$row->replace()) {
             return false;
         }
     } else {
         if (!$row->delete()) {
             return false;
         }
     }
     if (false === $link->increase('link_favcount', $bool ? 1 : -1)) {
         return false;
     }
     if (false === $link->onCalcPopularity()) {
         return false;
     }
     return true;
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:26,代碼來源:GWF_LinksFavorite.php

示例5: setFavorite

 public static function setFavorite($userid, $siteid, $bool)
 {
     $entry = new self(array('sitefav_uid' => $userid, 'sitefav_sid' => $siteid));
     if ($bool === true) {
         return $entry->replace();
     } else {
         return $entry->delete();
     }
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:9,代碼來源:WC_SiteFavorites.php

示例6: clear

 /**
  * 清除所有SessionFile
  * @return boolean
  */
 static function clear()
 {
     $ret = TRUE;
     if ($sessions = $_SESSION['_Hiano_Session']['SessionFile']) {
         foreach ($sessions as $s_name => $s_value) {
             $sf = new self($s_name);
             if (!$sf->delete()) {
                 $ret = false;
             }
         }
     }
     return $ret;
 }
開發者ID:kasonyang,項目名稱:hiano,代碼行數:17,代碼來源:Session.php

示例7: cleanup

 static function cleanup($profile_list)
 {
     $subs = new self();
     $subs->profile_tag_id = $profile_list->id;
     $subs->find();
     while ($subs->fetch()) {
         $profile = Profile::getKV('id', $subs->profile_id);
         Event::handle('StartUnsubscribePeopletag', array($profile_list, $profile));
         // Delete anyway
         $subs->delete();
         Event::handle('StartUnsubscribePeopletag', array($profile_list, $profile));
     }
 }
開發者ID:bashrc,項目名稱:gnusocial-debian,代碼行數:13,代碼來源:Profile_tag_subscription.php

示例8: uninstall

 static function uninstall()
 {
     global $DB;
     //uninstall container table and class
     $obj = new self();
     $containers = $obj->find();
     foreach ($containers as $containers_id => $container) {
         $obj->delete(array('id' => $containers_id));
     }
     //drop global container table
     $obj = new self();
     $DB->query("DROP TABLE IF EXISTS `" . $obj->getTable() . "`");
     //delete display preferences for this item
     $DB->query("DELETE FROM glpi_displaypreferences WHERE `itemtype` = '" . __CLASS__ . "'");
     return true;
 }
開發者ID:publik1974,項目名稱:fields,代碼行數:16,代碼來源:container.class.php

示例9: linkIPAddressFromIPNetwork

 /**
  * Update IPNetwork's dependency
  *
  * @param $network IPNetwork object
  **/
 static function linkIPAddressFromIPNetwork(IPNetwork $network)
 {
     global $DB;
     $linkObject = new self();
     $linkTable = $linkObject->getTable();
     $ipnetworks_id = $network->getID();
     // First, remove all links of the current Network
     $query = "SELECT `id`\n                FROM `{$linkTable}`\n                WHERE `ipnetworks_id` = '{$ipnetworks_id}'";
     foreach ($DB->request($query) as $link) {
         $linkObject->delete(array('id' => $link['id']));
     }
     // Then, look each IP address contained inside current Network
     $query = "SELECT '" . $ipnetworks_id . "' AS ipnetworks_id,\n                       `id` AS ipaddresses_id\n                FROM `glpi_ipaddresses`\n                WHERE " . $network->getWHEREForMatchingElement('glpi_ipaddresses', 'binary', 'version') . "\n                GROUP BY `id`";
     foreach ($DB->request($query) as $link) {
         $linkObject->add($link);
     }
 }
開發者ID:gaforeror,項目名稱:glpi,代碼行數:22,代碼來源:ipaddress_ipnetwork.class.php

示例10: retrieve

 public static function retrieve($endpoint, $params = null, $method = 'get')
 {
     $fs = new self();
     $method = strtolower($method);
     switch ($method) {
         case 'get':
             return $fs->get($endpoint, $params);
             break;
         case 'post':
             return $fs->post($endpoint, $params);
             break;
         case 'delete':
             return $fs->delete($endpoint, $params);
             break;
         default:
             throw new ddFoursquareBadRequestException('The given method is invalid.');
     }
 }
開發者ID:ner0tic,項目名稱:ddFoursquare,代碼行數:18,代碼來源:ddFoursquare.class.php

示例11: refreshOnline

 public static function refreshOnline($IDUser = null, $Location = null)
 {
     if (!isset($IDUser)) {
         $IDUser = Zend_Auth::getInstance()->getIdentity()->IDUser;
     }
     $TheOnline = new self();
     $Data = array('Date' => new Zend_Db_Expr('NOW()'));
     if (isset($Location)) {
         $Data['IDLocation'] = $Location;
     }
     $Online = $TheOnline->fetchAll("IDUser = '{$IDUser}'");
     if ($Online->count() == 1) {
         $TheOnline->update($Data, "IDUser = '{$IDUser}'");
     } else {
         if ($Online->count() > 1) {
             $TheOnline->delete("IDUser = '{$IDUser}'");
         }
         $Data['IDUser'] = $IDUser;
         $TheOnline->insert($Data);
     }
 }
開發者ID:BGCX262,項目名稱:zweer-gdr-svn-to-git,代碼行數:21,代碼來源:Online.php

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

示例13: deleteUserPortfolios

 /**
  * Delete all portfolio data for user
  * 
  * @param int $a_user_id 
  */
 public static function deleteUserPortfolios($a_user_id)
 {
     $all = self::getPortfoliosOfUser($a_user_id);
     if ($all) {
         include_once "Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php";
         $access_handler = new ilPortfolioAccessHandler();
         foreach ($all as $item) {
             $access_handler->removePermission($item["id"]);
             $portfolio = new self($item["id"], false);
             $portfolio->delete();
         }
     }
 }
開發者ID:arlendotcn,項目名稱:ilias,代碼行數:18,代碼來源:class.ilObjPortfolio.php

示例14: setConfig

 /**
  * Change a particular configuration value
  *
  * @param string    $feature Feature
  * @param mixed     $value   Value
  * @param CMbObject $object  Host object
  *
  * @return null|string Store-like message
  */
 static function setConfig($feature, $value, CMbObject $object = null)
 {
     $where = array("feature" => "= '{$feature}'");
     if ($object) {
         $where["object_class"] = "= '{$object->_class}'";
         $where["object_id"] = "= '{$object->_id}'";
     } else {
         $where["object_class"] = "IS NULL";
         $where["object_id"] = "IS NULL";
     }
     $_config = new self();
     $_config->loadObject($where);
     $inherit = $value === self::INHERIT;
     if ($_config->_id && $inherit) {
         return $_config->delete();
     } elseif (!$inherit) {
         if ($object) {
             $_config->setObject($object);
         } else {
             $_config->object_id = null;
             $_config->object_class = null;
         }
         $_config->feature = $feature;
         $_config->value = $value;
         return $_config->store();
     }
     return null;
 }
開發者ID:OpenXtrem,項目名稱:mediboard-test,代碼行數:37,代碼來源:CConfiguration.class.php

示例15: deleteConfigurationValues

 /**
  * Delete config entries
  *
  * @since version 0.85
  *
  * @param $context string  context to get values (default for glpi is core)
  * @param $values  array   of config names to delete
  *
  * @return array of config values
  **/
 static function deleteConfigurationValues($context, array $values = array())
 {
     $config = new self();
     foreach ($values as $value) {
         if ($config->getFromDBByQuery("WHERE `context` = '{$context}'\n                                              AND `name` = '{$value}'")) {
             $config->delete(array('id' => $config->getID()));
         }
     }
 }
開發者ID:UnidadInformaticaSERVIUVI,項目名稱:Administrador-de-Inventario,代碼行數:19,代碼來源:config.class.php


注:本文中的self::delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。