本文整理汇总了PHP中Update::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Update::load方法的具体用法?PHP Update::load怎么用?PHP Update::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Update
的用法示例。
在下文中一共展示了Update::load方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public static function update($updateID = null)
{
if ($updateID == null) {
return null;
}
$update = Update::load($updateID);
// $user = User::load($update->getCreatorID());
// $username = $user->getUsername();
$title = $update->getTitle();
$accepted = Accepted::load($update->getAcceptedID());
return array_merge(self::task($accepted->getTaskID()), self::oneCrumb($title, Url::update($updateID)));
}
示例2: formatUserLink
$body = "<p>" . formatUserLink(Session::getUserID()) . ' commented on your task update <a href="' . Url::update($updateID) . '">' . $update->getTitle() . '</a> in the project ' . formatProjectLink($project->getID()) . '. The comment was:</p>';
$body .= "<blockquote>" . formatUpdate($message) . "</blockquote>";
$email = array('to' => $creator->getEmail(), 'subject' => '[' . PIPELINE_NAME . '] New comment on your task update in ' . $project->getTitle(), 'message' => $body);
// send email
Email::send($email);
}
}
// send us back
Session::setMessage('You commented on this update.');
$json = array('success' => '1');
echo json_encode($json);
}
} elseif ($action == 'comment-reply') {
// validate update
$updateID = Filter::numeric($_GET['u']);
$update = Update::load($updateID);
if ($update == null) {
header('Location: ' . Url::error());
exit;
}
$commentID = Filter::numeric($_POST['commentID']);
$message = Filter::formattedText($_POST['message']);
if ($message == '') {
$json = array('error' => 'Your reply cannot be empty.');
exit(json_encode($json));
} else {
// post the comment
$reply = new Comment(array('creator_id' => Session::getUserID(), 'project_id' => $project->getID(), 'update_id' => $updateID, 'parent_id' => $commentID, 'message' => $message));
$reply->save();
// log it
$logEvent = new Event(array('event_type_id' => 'create_update_comment_reply', 'project_id' => $project->getID(), 'user_1_id' => Session::getUserID(), 'item_1_id' => $commentID, 'item_2_id' => $reply->getID(), 'item_3_id' => $updateID, 'data_1' => $message));
示例3: getUploadCssClass
});
});
</script>
<div id="flowplayer" style="overflow: hidden;"></div>
<div id="imageviewer" style="overflow: hidden;"></div>
<div id="flashviewer"></div>
<?php
function getUploadCssClass($ext)
{
$className = '';
switch ($ext) {
case 'jpg':
case 'jpeg':
case 'png':
case 'gif':
$className = 'image';
break;
case 'mp3':
$className = 'audio';
break;
case 'fla':
case 'swf':
case 'flv':
$className = 'flash';
break;
case 'mpeg':
case 'mp4':
case '3gp':
case 'mpg':
case 'mov':
case 'avi':
示例4: formatEvent
function formatEvent($event, $showProject = false)
{
switch ($event->getEventTypeID()) {
case 'create_user':
$formatted = sprintf("%s registered for %s.", formatUserLink($event->getUser1ID()), '<a href="' . Url::base() . '">' . PIPELINE_NAME . '</a>');
break;
case 'send_message':
$formatted = sprintf("%s sent a message to %s.", formatUserLink($event->getUser1ID()), formatUserLink($event->getUser2ID()));
break;
case 'accept_member_invitation':
$predicate = $showProject ? 'the project ' . formatProjectLink($event->getProjectID()) : "this project";
$formatted = sprintf("%s accepted %s's invitation to join %s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), formatUserLink($event->getUser2ID(), $event->getProjectID()), $predicate);
break;
case 'trust_member':
$predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : '';
$formatted = sprintf("%s trusted %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), formatUserLink($event->getUser2ID(), $event->getProjectID()), $predicate);
break;
case 'untrust_member':
$predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : '';
$formatted = sprintf("%s untrusted %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), formatUserLink($event->getUser2ID(), $event->getProjectID()), $predicate);
break;
case 'join_project':
$predicate = $showProject ? ' ' . formatProjectLink($event->getProjectID()) : '';
$formatted = sprintf("%s joined the project%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), $predicate);
break;
case 'leave_project':
$predicate = $showProject ? ' ' . formatProjectLink($event->getProjectID()) : '';
$formatted = sprintf("%s left the project%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), $predicate);
break;
case 'follow_project':
$predicate = $showProject ? ' ' . formatProjectLink($event->getProjectID()) : '';
$formatted = sprintf("%s followed the project%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), $predicate);
break;
case 'unfollow_project':
$predicate = $showProject ? ' ' . formatProjectLink($event->getProjectID()) : '';
$formatted = sprintf("%s unfollowed the project%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), $predicate);
break;
case 'ban_user':
$predicate = $showProject ? ' from the project ' . formatProjectLink($event->getProjectID()) : '';
$formatted = sprintf("%s banned %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), formatUserLink($event->getUser2ID(), $event->getProjectID()), $predicate);
break;
case 'unban_user':
$predicate = $showProject ? ' from the project ' . formatProjectLink($event->getProjectID()) : '';
$formatted = sprintf("%s unbanned %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), formatUserLink($event->getUser2ID(), $event->getProjectID()), $predicate);
break;
case 'create_project':
$predicate = $showProject ? 'the project ' . formatProjectLink($event->getProjectID()) : 'this project';
$formatted = sprintf("%s created %s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), formatProjectLink($event->getProjectID()));
break;
case 'edit_pitch':
$predicate = $showProject ? ' for the project ' . formatProjectLink($event->getProjectID()) : '';
$formatted = sprintf("%s edited the %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . Url::pitch($event->getProjectID()) . '">pitch</a>', $predicate);
break;
case 'edit_specs':
$predicate = $showProject ? ' for the project ' . formatProjectLink($event->getProjectID()) : '';
$formatted = sprintf("%s edited the %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . Url::specs($event->getProjectID()) . '">specs</a>', $predicate);
break;
case 'edit_rules':
$predicate = $showProject ? ' for the project ' . formatProjectLink($event->getProjectID()) : '';
$formatted = sprintf("%s edited the %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . Url::rules($event->getProjectID()) . '">rules</a>', $predicate);
break;
case 'edit_project_status':
$predicate = $showProject ? 'the project ' . formatProjectLink($event->getProjectID()) : 'this project';
$status = $event->getData2();
$formatted = sprintf("%s changed the %s of %s to “%s.”", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . Url::status($event->getProjectID()) . '">status</a>', $predicate, formatProjectStatus($status));
break;
case 'edit_project_deadline':
$deadline = $event->getData2();
if ($deadline != null) {
$predicate = $showProject ? 'the project ' . formatProjectLink($event->getProjectID()) : 'this project';
$formatted = sprintf("%s changed the %s of %s to %s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . Url::deadline($event->getProjectID()) . '">deadline</a>', $predicate, strftime("%a, %b %d, %Y", strtotime($deadline)));
} else {
$predicate = $showProject ? 'the project ' . formatProjectLink($event->getProjectID()) : 'this project';
$formatted = sprintf("%s removed the %s for %s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . Url::deadline($event->getProjectID()) . '">deadline</a>', $predicate);
}
break;
case 'create_discussion':
$predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : '';
$discussion = Discussion::load($event->getItem1ID());
$title = $discussion->getTitle();
$url = Url::discussion($discussion->getID());
$formatted = sprintf("%s posted the discussion %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate);
break;
case 'lock_discussion':
$predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : '';
$discussion = Discussion::load($event->getItem1ID());
$title = $discussion->getTitle();
$url = Url::discussion($discussion->getID());
$formatted = sprintf("%s locked the discussion %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate);
break;
case 'unlock_discussion':
$predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : '';
$discussion = Discussion::load($event->getItem1ID());
$title = $discussion->getTitle();
$url = Url::discussion($discussion->getID());
$formatted = sprintf("%s unlocked the discussion %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate);
break;
case 'create_discussion_reply':
$predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : '';
$discussion = Discussion::load($event->getItem2ID());
//.........这里部分代码省略.........
示例5: getUpdateEvents
public static function getUpdateEvents($updateID = null, $limit = null)
{
if ($updateID == null) {
return null;
}
$update = Update::load($updateID);
$query = "SELECT e.id AS id FROM " . self::DB_TABLE . " e";
$query .= " INNER JOIN " . EventType::DB_TABLE . " et ON ";
$query .= " e.event_type_id = et.id";
$query .= " WHERE (e.item_1_id = " . $updateID;
$query .= " AND e.event_type_id = 'create_update')";
$query .= " OR (e.item_1_id = " . $updateID;
$query .= " AND e.event_type_id = 'edit_update_title')";
$query .= " OR (e.item_1_id = " . $updateID;
$query .= " AND e.event_type_id = 'edit_update_message')";
$query .= " OR (e.item_1_id = " . $updateID;
$query .= " AND e.event_type_id = 'edit_update_uploads')";
$query .= " OR (e.item_1_id = " . $updateID;
$query .= " AND e.event_type_id = 'edit_accepted_status')";
$query .= " OR (e.item_2_id = " . $updateID;
$query .= " AND e.event_type_id = 'create_update_comment')";
$query .= " OR (e.item_3_id = " . $updateID;
$query .= " AND e.event_type_id = 'create_update_comment_reply')";
$query .= " AND et.hidden = 0";
$query .= " ORDER BY date_created DESC";
if ($limit != null) {
$query .= " LIMIT " . $limit;
}
$db = Db::instance();
$result = $db->lookup($query);
if (!mysql_num_rows($result)) {
return array();
}
$events = array();
while ($row = mysql_fetch_assoc($result)) {
$events[$row['id']] = self::load($row['id']);
}
return $events;
}
示例6: update
public static function update($updateID = null)
{
if ($updateID == null) {
return null;
}
$update = Update::load($updateID);
$accepted = Accepted::load($update->getAcceptedID());
return self::task($accepted->getTaskID()) . '/updates/' . $updateID;
}