本文整理汇总了PHP中Track::addEntry方法的典型用法代码示例。如果您正苦于以下问题:PHP Track::addEntry方法的具体用法?PHP Track::addEntry怎么用?PHP Track::addEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Track
的用法示例。
在下文中一共展示了Track::addEntry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
function save()
{
// nothing changed, then don't save (so the timestamp remains the same, so it does not appear as if it needs translation again)!
if ($this->changed == false) {
return;
}
global $db;
//$query = "replace into " . Config::dbSurvey() . "_settings (suid, object, objecttype, name, value, mode, language) values(";
$query = "replace into " . Config::dbSurvey() . "_settings (suid, object, objecttype, name, value, mode, language) values(?,?,?,?,?,?,?)";
$suid = $this->getSuid();
$object = $this->getObject();
$objecttype = $this->getObjectType();
$name = $this->getName();
$value = $this->getValue();
if ($this->getMode() != "") {
$mode = $this->getMode();
} else {
$mode = getSurveyMode();
}
if ($this->getLanguage() != "") {
$language = $this->getLanguage();
} else {
$language = getSurveyLanguage();
}
$bp = new BindParam();
$bp->add(MYSQL_BINDING_INTEGER, $suid);
$bp->add(MYSQL_BINDING_INTEGER, $object);
$bp->add(MYSQL_BINDING_STRING, $objecttype);
$bp->add(MYSQL_BINDING_STRING, $name);
$bp->add(MYSQL_BINDING_STRING, $value);
$bp->add(MYSQL_BINDING_INTEGER, $mode);
$bp->add(MYSQL_BINDING_STRING, $language);
$db->executeBoundQuery($query, $bp->get());
/* save history if value change */
if ($this->previousvalue != $value) {
$track = new Track($suid, $object, $objecttype);
$track->addEntry($name, $value);
}
// update previous values now we saved
$this->previousvalue = $this->getValue();
$this->previousobject = $this->getObject();
$this->previoussuid = $this->getSuid();
$this->previouslanguage = $this->getLanguage();
$this->previousmode = $this->getMode();
$this->previousobjecttype = $this->getObjectType();
}
示例2: storeRouting
function storeRouting($routing)
{
global $db;
//remove old ones
$result = $db->executeQuery('delete from ' . Config::dbSurvey() . '_routing where suid = ' . prepareDatabaseString($this->getSuid()) . ' and seid = ' . prepareDatabaseString($this->getSeid()));
$query = 'insert into ' . Config::dbSurvey() . '_routing (suid, seid, rgid, rule) VALUES ';
$routinglines = explode("\r\n", rtrim($routing));
$lines = array();
$cnt = 1;
foreach ($routinglines as $line) {
$lines[] = '(' . prepareDatabaseString($this->getSuid()) . ', ' . prepareDatabaseString($this->getSeid()) . ',' . $cnt . ', "' . prepareDatabaseString($line, false) . '")';
$cnt++;
}
$query .= implode($lines, ',');
$result = $db->executeQuery($query);
//add new lines
/* save history if value change */
$track = new Track($this->getSuid(), $this->getObjectName(), $this->getObjectType());
$track->addEntry(SETTING_ROUTING, $routing);
}