本文整理汇总了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();
}
}
示例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);
}
示例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;
}
示例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;
}
示例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();
}
}
示例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;
}
示例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));
}
}
示例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;
}
示例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);
}
}
示例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.');
}
}
示例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);
}
}
示例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();
}
}
示例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();
}
}
}
示例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;
}
示例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()));
}
}
}