本文整理汇总了PHP中Statement::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Statement::getId方法的具体用法?PHP Statement::getId怎么用?PHP Statement::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Statement
的用法示例。
在下文中一共展示了Statement::getId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onSetAnswer
public function onSetAnswer(FrontController $sender, Statement $st)
{
$users = $st->getSubscribers();
if ($users) {
require_once ST_DIR . '/Classes/Mailer.php';
$mailer = new Mailer();
$vars = array('answer' => strip_tags($st->getAnswer()), 'st_link' => FrontController::getURLByRoute('view', array('id' => $st->getId()), true), 'title' => $st->getTitle(), 'status' => $st->getStatusName());
foreach ($users as $user) {
$vars['username'] = $user->name;
$vars['unSubscribeLink'] = $this->_getSubscribeLink($user->email, $user->user_id, $st->getId());
$mailer->sendMail('SubscribeStatementSetAnswer', $user->email, $vars);
}
}
}
示例2: renderStatement
public function renderStatement(Statement $st, $template)
{
$vars = array('id' => $st->getId(), 'st-url' => FrontController::getURLByRoute('view', array('id' => $st->getId())), 'title' => $st->getTitle(), 'teaser' => $st->getTeaser(), 'text' => $st->getText(), 'username' => $st->getUsername(), 'answer' => nl2br($st->getAnswer()), 'answer_name' => $st->getAnswerName(), 'plus_count' => $st->getPlusCount(), 'minus_count' => $st->getMinusCount(), 'comm_num' => $st->getCommNum(), 'status' => t($st->getStatusName()), 'status_icon' => $st->getStatus(), 'date' => date('j.m.Y H:i', $st->getDate()), 'category' => $st->getCategoryName(), 'rate' => $st->getPlusCount() - $st->getMinusCount(), 'comments' => $st->getComments(), 'new_comments' => $st->getNewComment(), 'type' => t($st->getTypeName()), 'type_icon' => $st->getType(), 'edit_link' => FrontController::getURLByRoute('editStatement', array('id' => $st->getId())));
$blocks = array();
if ($st->getIsset()) {
$blocks['isset'] = true;
}
if ($st->getAnswerId()) {
$blocks['answer'] = true;
}
if (in_array($this->_user->user_group, FrontController::$config['moder_groups']) || in_array($this->_user->user_id, FrontController::$config['moders'])) {
$blocks['moder'] = true;
}
return $this->render($template, $vars, $blocks);
}
示例3: deleteAndSave
/**
* Delete the reference and push the change to the database
*
* @param string $summary summary for the change
* @throws Exception
*/
public function deleteAndSave($summary = '')
{
$id = $this->statement->getId();
if ($id === null) {
throw new Exception('Statement has no Id. Please save the statement first.');
}
if ($this->hash !== null) {
$this->statement->getEntity()->getApi()->removeReferences($id, array($this->hash), $this->statement->getEntity()->getLastRevisionId(), $summary);
}
$this->statement->removeReference($this);
}
示例4: setStatement
public function setStatement(Statement $st)
{
$this->_statement = $st;
$this->_original_data['id'] = $st->getId();
$this->_original_data['answer'] = $st->getAnswer();
$this->_original_data['text'] = $this->getParse()->decodeBBCodes($st->getText(), false);
$this->_original_data['title'] = $st->getTitle();
$this->_original_data['type'] = $st->getType();
$this->_original_data['category'] = $st->getCategory();
$this->_original_data['status'] = $st->getStatus();
}
示例5: saveStatement
public function saveStatement($statement)
{
if (!$statement instanceof Statement) {
$statement = new Statement($statement);
}
$requestCfg = array('headers' => array('Content-Type' => 'application/json'), 'content' => json_encode($statement->asVersion($this->version), JSON_UNESCAPED_SLASHES));
if ($statement->hasAttachmentsWithContent()) {
$this->_buildAttachmentContent($requestCfg, $statement->getAttachments());
}
$method = 'POST';
if ($statement->hasId()) {
$method = 'PUT';
$requestCfg['params'] = array('statementId' => $statement->getId());
}
$response = $this->sendRequest($method, 'statements', $requestCfg);
if ($response->success) {
if (!$statement->hasId()) {
$parsed_content = json_decode($response->content, true);
$statement->setId($parsed_content[0]);
}
//
// save statement either returns no content when there is an id
// or returns the id when there wasn't, either way the caller
// may have called us with a statement configuration rather than
// a Statement object, so provide them back the Statement object
// as the content in either case on success
//
$response->content = $statement;
}
return $response;
}
示例6: onNewComment
public function onNewComment(FrontController $sender, Comment $comment, Statement $st)
{
$vars = array('username' => $comment->getUsername(), 'text' => strip_tags($comment->getText()), 'st_link' => FrontController::getURLByRoute('@view', array('id' => $st->getId()), true), 'title' => $st->getTitle());
$this->getMailer()->sendMail('newComment', $this->_getModerEmails(), $vars);
}
示例7: _getVars
protected function _getVars()
{
return array('statement_id' => $this->_st->getId());
}