本文整理匯總了PHP中Tracker::setLink方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tracker::setLink方法的具體用法?PHP Tracker::setLink怎麽用?PHP Tracker::setLink使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Tracker
的用法示例。
在下文中一共展示了Tracker::setLink方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getTrackers
/**
* Retourne tous les trackers
*
* @return array
*/
public static function getTrackers()
{
$oMysqli = Database::getInstance();
$oResults = $oMysqli->query("SELECT t.*, (SELECT COUNT(*) FROM tks_passkey AS p WHERE t.id = p.id_tracker) AS nb_passkey \r\n FROM tks_trackers as t ");
$aResults = array();
while ($aResult = $oResults->fetch_assoc()) {
$oTracker = new Tracker($aResult['name'], $aResult['id']);
$oTracker->setLink($aResult['link']);
$oTracker->setDirectLink($aResult['directlink']);
$oTracker->setNbPasskeys($aResult['nb_passkey']);
$aResults[$aResult['id']] = $oTracker;
}
return $aResults;
}
示例2: procede
public function procede()
{
try {
if ($this->oRequest->existParam('name')) {
if ($this->oRequest->existParam('edit')) {
$oTracker = new Tracker($this->oRequest->getParam('name', 'string'), $this->oRequest->getParam('edit', 'int'));
} else {
$oTracker = new Tracker($this->oRequest->getParam('name', 'string'));
}
if ($this->oRequest->existParam('link')) {
$oTracker->setLink($this->oRequest->getParam('link', 'string'));
}
if ($this->oRequest->existParam('directlink')) {
$oTracker->setDirectLink($this->oRequest->getParam('directlink', 'string'));
}
if ($this->oRequest->existParam('edit')) {
//Suppression
if ($this->oRequest->existParam('delete') && $this->oRequest->getParam('delete', 'boolean')) {
$oTracker->delete();
Logger::log('admin', 'Le Tracker ' . $this->oRequest->getParam('name', 'string') . ' a été supprimé par ' . $this->oCurrentUser->getLogin());
$this->oView->addAlert('Le Tracker ' . $this->oRequest->getParam('name', 'string') . ' a été supprimé.', 'success');
} else {
//Edit
$oTracker->update();
Logger::log('admin', 'Le Tracker ' . $this->oRequest->getParam('name', 'string') . ' a été modifié par ' . $this->oCurrentUser->getLogin());
$this->oView->addAlert('Le Tracker ' . $this->oRequest->getParam('name', 'string') . ' a été modifié.', 'success');
}
} else {
$oTracker->store();
Logger::log('admin', 'Le Tracker ' . $this->oRequest->getParam('name', 'string') . ' a été ajouté par ' . $this->oCurrentUser->getLogin());
$this->oView->addAlert('Le Tracker ' . $this->oRequest->getParam('name', 'string') . ' a été ajouté.', 'success');
}
} elseif ($this->oRequest->existParam('import')) {
$sFile = './trackers/' . $this->oRequest->getParam('import', 'string') . '.xml';
$oRssDoc = simpleXML_load_file($sFile);
if (!$oRssDoc) {
throw new Error('Impossible d\'ouvrir le fichier de configuration pour ' . $this->oRequest->getParam('import', 'string') . '.', 1132);
}
//Traitement des items
$oRssTracker = $oRssDoc->Tracker;
$oRssFlux = $oRssDoc->RSS;
$oTracker = new Tracker($oRssTracker->Name);
$oTracker->setLink(str_replace('&', '&', $oRssTracker->Link));
$oTracker->setDirectLink(str_replace('&', '&', $oRssTracker->DirectLink));
$oTracker->store();
if ($oRssFlux->ForceDate === 'true') {
$bForceDate = true;
} else {
$bForceDate = false;
}
$oFlux = new Rss($oTracker->getId(), str_replace('&', '&', $oRssFlux->Flux), str_replace('&', '&', $oRssFlux->Mask), $bForceDate, 0, $oRssFlux->Encoding);
$oFlux->store();
Logger::log('admin', 'Le Tracker ' . $this->oRequest->getParam('import', 'string') . ' a été ajouté par ' . $this->oCurrentUser->getLogin());
$this->oView->addAlert('Le Tracker ' . $this->oRequest->getParam('import', 'string') . ' a été ajouté.', 'success');
}
} catch (Exception $ex) {
$this->oView->addAlert($ex, 'danger');
} finally {
$this->createView();
}
}