本文整理汇总了PHP中History::add方法的典型用法代码示例。如果您正苦于以下问题:PHP History::add方法的具体用法?PHP History::add怎么用?PHP History::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类History
的用法示例。
在下文中一共展示了History::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetLength
public function testGetLength()
{
$instance = new History();
$this->assertEquals(0, $instance->getLength());
$instance->add('foo');
$this->assertEquals(1, $instance->getLength());
$instance->add('bar');
$this->assertEquals(2, $instance->getLength());
$instance->clear();
$this->assertEquals(0, $instance->getLength());
}
示例2: show_GET
function show_GET($w)
{
list($lotid, $householdid) = $w->pathMatch("lotid", "householdid");
if (empty($lotid)) {
$w->error("Need a Lot ID");
}
if (empty($householdid)) {
$w->error("Need a household ID");
}
$lot = $w->Bend->getLotForId($lotid);
if (empty($lot)) {
$w->error("Lot {$lotid} does not exist");
}
$household = $w->Bend->getHouseholdForId($householdid);
if (empty($household)) {
$w->error("Household {$householdid} does not exist");
}
History::add("Bend Household: " . $household->streetnumber);
$lotTable = array();
$lotTable["Household"] = array(array(array("Lot Number", "static", "", $lot->lot_number), array("Occupancy", "static", "", $lot->occupancy)), array(array("Street Number", "static", "", $household->streetnumber), array("Is CHL?", "static", "", $household->is_chl ? "yes" : "no"), array("Is Occupied?", "static", "", $household->is_occupied ? "yes" : "no"), array("Number of Occupants", "static", "", $household->num_occupants)));
$w->ctx("lot", $lot);
$w->ctx("table", Html::multiColTable($lotTable));
$w->ctx("household", $household);
$w->ctx("currentOccupants", $household->getCurrentOccupants());
$w->ctx("pastOccupants", $household->getPastOccupants());
}
示例3: admin_ALL
function admin_ALL(Web $w)
{
History::add("Workhours Admin");
$w->ctx("workperiods", $w->Bend->getAllWorkPeriods());
$w->ctx("focusgroups", $w->Bend->getTopLevelWorkCategories());
$w->enqueueStyle(["uri" => "/modules/bend/assets/css/bend.css", "weight" => 500]);
}
示例4: list_GET
function list_GET(Web $w)
{
History::add("List Workhours");
list($userid, $periodid) = $w->pathMatch("a", "b");
// get the user
if (!empty($userid)) {
$user = $w->Auth->getUser($userid);
} else {
$user = $w->Auth->user();
}
// calculate total work hours for this period
$workentries = $w->Bend->getWorkhoursForUser($user, $periodid);
$total_worked = 0;
$total_accredited = 0;
if (!empty($workentries)) {
foreach ($workentries as $we) {
$total_worked += $we->hours;
if ($we->user_id == $we->attributed_user_id) {
$total_accredited += $we->hours;
}
}
}
$w->ctx("total_worked", $total_worked);
$w->ctx("total_accredited", $total_accredited);
$w->ctx("user", $user);
$w->ctx("workentries", $workentries);
$w->ctx("workPeriod", $w->Bend->getWorkPeriodForId($periodid));
$w->ctx("allWorkPeriods", $w->Bend->getAllWorkPeriods());
}
示例5: update
/**
* Modifies an Issue's Reporter.
*
* @param integer $issue_id The id of the issue.
* @param string $fullname The id of the user.
* @param boolean $add_history If this should be logged.
* @return int
*/
public static function update($issue_id, $email, $add_history = true)
{
$email = strtolower(Mail_Helper::getEmailAddress($email));
$usr_id = User::getUserIDByEmail($email, true);
// If no valid user found reset to system account
if (!$usr_id) {
$usr_id = APP_SYSTEM_USER_ID;
}
$sql = 'UPDATE
{{%issue}}
SET
iss_usr_id = ?
WHERE
iss_id = ?';
try {
DB_Helper::getInstance()->query($sql, array($usr_id, $issue_id));
} catch (DbException $e) {
return -1;
}
if ($add_history) {
// TRANSLATORS: %1: email, %2: full name
$current_usr_id = Auth::getUserID();
History::add($issue_id, $current_usr_id, 'issue_updated', 'Reporter was changed to {email} by {user}', array('email' => $email, 'user' => User::getFullName($current_usr_id)));
}
// Add new user to notification list
if ($usr_id > 0) {
Notification::subscribeEmail($usr_id, $issue_id, $email, Notification::getDefaultActions());
}
return 1;
}
示例6: viewtaskgrouptypes_ALL
function viewtaskgrouptypes_ALL(Web $w)
{
$w->Task->navigation($w, "Manage Task Groups");
History::add("Manage Task Groups");
$task_groups = $w->Task->getTaskGroups();
if ($task_groups) {
usort($task_groups, array("TaskService", "sortbyGroup"));
}
// prepare column headings for display
$line = array(array("Title", "Type", "Description", "Default Assignee"));
// if task group exists, display title, group type, description, default assignee and button for specific task group info
if ($task_groups) {
foreach ($task_groups as $group) {
$line[] = array(Html::a(WEBROOT . "/task-group/viewmembergroup/" . $group->id, $group->title), $group->getTypeTitle(), $group->description, $group->getDefaultAssigneeName());
}
} else {
// if no groups for this group type, say as much
$line[] = array("There are no Task Groups Configured. Please create a New Task Group.", "", "", "", "");
}
// display list of task groups in the target task group type
$w->ctx("dashboard", Html::table($line, null, "tablesorter", true));
// tab: new task group
// get generic task group permissions
$arrassign = $w->Task->getTaskGroupPermissions();
// unset 'ALL' given all can never assign a task
unset($arrassign[0]);
// set Is Task Active dropdown
$is_active = array(array("Yes", "1"), array("No", "0"));
$grouptypes = $w->Task->getAllTaskGroupTypes();
// build form to create a new task group within the target group type
$f = Html::form(array(array("Task Group Attributes", "section"), array("Task Group Type", "select", "task_group_type", null, $grouptypes), array("Title", "text", "title"), array("Who Can Assign", "select", "can_assign", null, $arrassign), array("Who Can View", "select", "can_view", null, $w->Task->getTaskGroupPermissions()), array("Who Can Create", "select", "can_create", null, $w->Task->getTaskGroupPermissions()), array("Active", "select", "is_active", null, $is_active), array("", "hidden", "is_deleted", "0"), array("Description", "textarea", "description", null, "26", "6"), array("Default Assignee", "select", "default_assignee_id", null, $w->Auth->getUsers())), $w->localUrl("/task-group/createtaskgroup"), "POST", "Save");
// display form
$w->ctx("creategroup", $f);
}
示例7: showperiod_GET
function showperiod_GET(Web $w)
{
list($id) = $w->pathMatch("a");
$wp = $w->Bend->getWorkperiodForId($id);
if (empty($wp)) {
$w->error("Workperiod does not exist", "/bend-workhours/admin");
}
History::add("Work Period: " . formatDate($wp->d_start));
$w->ctx("workperiod", $wp);
$w->ctx("categories", $w->Bend->getTopLevelWorkCategories());
$w->ctx("households", $w->Bend->getAllHouseholds());
}
示例8: viewmembergroup_GET
function viewmembergroup_GET(Web $w)
{
$p = $w->pathMatch("id");
// tab: Members
// get all members in a task group given a task group ID
$member_group = $w->Task->getMemberGroup($p['id']);
// get the group attributes given a task group ID
$group = $w->Task->getTaskGroup($p['id']);
// put the group title into the page heading
$w->Task->navigation($w, "Task Group - " . $group->title);
History::add("Task Group: " . $group->title);
// set columns headings for display of members
$line[] = array("Member", "Role", "");
// if their are members, display their full name, role and buttons to edit or delete the member
if ($member_group) {
foreach ($member_group as $member) {
$line[] = array($w->Task->getUserById($member->user_id), $member->role, Html::box(WEBROOT . "/task-group/viewmember/" . $member->id, " Edit ", true) . " " . Html::box(WEBROOT . "/task-group/deletegroupmember/" . $member->id, " Delete ", true));
}
} else {
// if there are no members, say as much
$line[] = array("Group currently has no members. Please Add New Members.", "", "");
}
// enter task group attributes sa query string for buttons providing group specific functions such as delete or add members
$w->ctx("taskgroup", $group->task_group_type);
$w->ctx("grpid", $group->id);
$w->ctx("groupid", $p['id']);
// display list of group members
$w->ctx("viewmembers", Html::table($line, null, "tablesorter", true));
// tab: Notify
$notify = $w->Task->getTaskGroupNotify($group->id);
if ($notify) {
foreach ($notify as $n) {
$v[$n->role][$n->type] = $n->value;
}
} else {
$v['guest']['creator'] = 0;
$v['member']['creator'] = 0;
$v['member']['assignee'] = 0;
$v['owner']['creator'] = 0;
$v['owner']['assignee'] = 0;
$v['owner']['other'] = 0;
}
$notifyForm['Task Group Notifications'] = array(array(array("", "hidden", "task_group_id", $group->id)), array(array("", "static", ""), array("Creator", "static", "creator"), array("Assignee", "static", "assignee"), array("All Others", "static", "others")), array(array("Guest", "static", "guest"), array("", "checkbox", "guest_creator", $v['guest']['creator'])), array(array("Member", "static", "member"), array("", "checkbox", "member_creator", $v['member']['creator']), array("", "checkbox", "member_assignee", $v['member']['assignee'])), array(array("Owner", "static", "owner"), array("", "checkbox", "owner_creator", $v['owner']['creator']), array("", "checkbox", "owner_assignee", $v['owner']['assignee']), array("", "checkbox", "owner_other", $v['owner']['other'])));
$w->ctx("notifymatrix", Html::multiColForm($notifyForm, $w->localUrl("/task-group/updategroupnotify/"), "POST", " Submit "));
}
示例9: showlot_GET
function showlot_GET(Web $w)
{
list($id) = $w->pathMatch("id");
if (empty($id)) {
$w->error("Need a Lot ID");
}
$lot = $w->Bend->getLotForId($id);
if (empty($lot)) {
$w->error("Lot {$id} does not exist");
}
History::add("Bend Lot: " . $lot->lot_number);
$lotTable = array();
$lotTable["Lot"] = array(array(array("Lot Number", "static", "", $lot->lot_number), array("Occupancy", "static", "", $lot->occupancy)));
$w->ctx("lot", $lot);
$w->ctx("lotTable", Html::multiColTable($lotTable));
$w->ctx("owners", $lot->getAllOwners());
$w->ctx("households", $lot->getAllHouseholds());
}
示例10: viewtaskgroup_GET
function viewtaskgroup_GET(Web &$w)
{
$p = $w->pathMatch("id");
// return task group details given a task group ID
$group_details = $w->Task->getTaskGroup($p['id']);
if (!empty($group_details)) {
History::add("Taskgroup: " . $group_details->title);
}
// if is_active is set to '0', display 'Yes', else display 'No'
$isactive = $group_details->is_active == "1" ? "Yes" : "No";
// set Is Task Active, Is Task Deleted dropdowns for display
$is_active = array(array("Yes", "1"), array("No", "0"));
$is_deleted = array(array("Yes", "1"), array("No", "0"));
// get generic task group permissions
$arrassign = $w->Task->getTaskGroupPermissions();
// unset 'ALL' given all can never assign a task
unset($arrassign[0]);
// build form displaying current attributes from database
$f = Html::form(array(array("Task Group Details", "section"), array("Task Group Type", "static", "task_group_type", $group_details->getTypeTitle()), array("Title", "text", "title", $group_details->title), array("Who Can Assign", "select", "can_assign", $group_details->can_assign, $arrassign), array("Who Can View", "select", "can_view", $group_details->can_view, $w->Task->getTaskGroupPermissions()), array("Who Can Create", "select", "can_create", $group_details->can_create, $w->Task->getTaskGroupPermissions()), array("Is Active", "select", "is_active", $group_details->is_active, $is_active), array("Description", "textarea", "description", $group_details->description, "26", "6"), array("Default Assignee", "select", "default_assignee_id", $group_details->default_assignee_id, $w->Task->getMembersInGroup($p['id']))), $w->localUrl("/task-group/updatetaskgroup/" . $group_details->id), "POST", " Update ");
// display form
$w->setLayout(null);
$w->ctx("viewgroup", $f);
}
示例11: setAssignees
/**
* Sets the assignees for the issue
*
* @param integer $issue_id
* @param array $assignees
* @return int 1 if success, -1 if error, 0 if no change was needed.
*/
public static function setAssignees($issue_id, $assignees)
{
if (!is_array($assignees)) {
$assignees = array();
}
// see if there is anything to change
$old_assignees = self::getAssignedUserIDs($issue_id);
if (count(array_diff($old_assignees, $assignees)) == 0 && count(array_diff($assignees, $old_assignees)) == 0) {
return 0;
}
$old_assignee_names = self::getAssignedUsers($issue_id);
Workflow::handleAssignmentChange(self::getProjectID($issue_id), $issue_id, Auth::getUserID(), self::getDetails($issue_id), $assignees, true);
// clear up the assignments for this issue, and then assign it to the current user
self::deleteUserAssociations($issue_id);
$assignee_names = array();
foreach ($assignees as $assignee) {
$res = self::addUserAssociation(Auth::getUserID(), $issue_id, $assignee, false);
if ($res == -1) {
return -1;
}
$assignee_names[] = User::getFullName($assignee);
Notification::subscribeUser(Auth::getUserID(), $issue_id, $assignee, Notification::getDefaultActions($issue_id, User::getEmail($assignee), 'set_assignees'), false);
}
Notification::notifyNewAssignment($assignees, $issue_id);
$usr_id = Auth::getUserID();
History::add($issue_id, $usr_id, 'user_associated', 'Issue assignment to changed ({changes}) by {user}', array('changes' => History::formatChanges(implode(', ', $old_assignee_names), implode(', ', $assignee_names)), 'user' => User::getFullName($usr_id)));
return 1;
}
示例12: uniqid
$error = IMG_SAVE_ROTATE_FAILED;
}
break;
default:
$error = IMG_SAVE_UNKNOWN_MODE;
}
if (empty($error)) {
$sessionNewPath = $sessionDir . uniqid(md5(time())) . "." . getFileExt($_POST['path']);
if (!@copy($originalImage, $sessionNewPath)) {
//keep a copy under the session folder
$error = IMG_SAVE_BACKUP_FAILED;
} else {
$isSaveAsRequest = !empty($_POST['new_name']) && !empty($_POST['save_to']) ? true : false;
//save the modified image
$sessionImageInfo = array('name' => basename($sessionNewPath), 'restorable' => 1);
$history->add($sessionImageInfo);
if (CONFIG_SYS_DEMO_ENABLE) {
//demo only
if (isset($originalSessionImageInfo) && sizeof($originalSessionImageInfo)) {
$imagePath = $sessionDir . $originalSessionImageInfo['info']['name'];
} else {
$imagePath = $sessionDir . uniqid(md5(time())) . "." . getFileExt($_POST['path']);
}
} else {
if ($isSaveAsRequest) {
//save as request
//check save to folder if exists
if (isset($_POST['save_to']) && strlen($_POST['save_to'])) {
$imagePath = $originalImage;
} else {
$imagePath = addTrailingSlash(backslashToSlash($_POST['save_to'])) . $_POST['new_name'] . "." . getFileExt($_POST['path']);
示例13: elseif
$res = Issue::deleteUserAssociation($iss_id, $usr_id);
Workflow::handleAssignmentChange($prj_id, $iss_id, Auth::getUserID(), Issue::getDetails($iss_id), Issue::getAssignedUserIDs($iss_id));
$tpl->assign('unassign_result', $res);
} elseif ($cat == 'remove_email') {
$res = Support::removeEmails();
$tpl->assign('remove_email_result', $res);
} elseif ($cat == 'clear_duplicate') {
$res = Issue::clearDuplicateStatus($iss_id);
$tpl->assign('clear_duplicate_result', $res);
} elseif ($cat == 'delete_phone') {
$res = Phone_Support::remove($id);
$tpl->assign('delete_phone_result', $res);
} elseif ($cat == 'new_status') {
$res = Issue::setStatus($iss_id, $status_id, true);
if ($res == 1) {
History::add($iss_id, $usr_id, 'status_changed', "Issue manually set to status '{status}' by {user}", array('status' => Status::getStatusTitle($status_id), 'user' => User::getFullName($usr_id)));
}
$tpl->assign('new_status_result', $res);
} elseif ($cat == 'authorize_reply') {
$res = Authorized_Replier::addUser($iss_id, $usr_id);
$tpl->assign('authorize_reply_result', $res);
} elseif ($cat == 'remove_quarantine') {
if (Auth::getCurrentRole() > User::getRoleID('Developer')) {
$res = Issue::setQuarantine($iss_id, 0);
$tpl->assign('remove_quarantine_result', $res);
}
} elseif ($cat == 'selfnotify') {
if (Issue::canAccess($iss_id, $usr_id)) {
$res = Notification::subscribeUser($usr_id, $iss_id, $usr_id, Notification::getDefaultActions($iss_id));
$tpl->assign('selfnotify_result', $res);
}
示例14: enter_GET
function enter_GET(Web $w)
{
History::add("Enter Workhours");
$form["Work Hours"] = array(array($w->Auth->hasRole("bend_admin") ? array("Who did the work?", "select", "user_id", $w->Auth->user()->id, $w->Bend->getOccupantUsers()) : array("Who did the work?", "static", "", $w->Auth->user()->getFullName()), array("Who to credit to", "select", "attributed_user_id", $w->Auth->user()->id, $w->Bend->getOccupantUsers()), array("Date", "date", "d_date"), array("Hours", "text", "hours")), array(array("Focus Group", "select", "category_1", null, $w->Bend->getTopLevelWorkCategories()), array("Team or Activity", "select", "category_2", null), array("Activity", "select", "category_3", null)), array(array("Description", "text", "description", "")));
$w->ctx("form", Html::multiColForm($form, "/bend-workhours/enter", "POST", "Save"));
}
示例15: attachFiles
/**
* Attach uploaded files to an issue
* It also notifies any subscribers of this new attachment.
*
* @param int $issue_id The issue ID
* @param int $usr_id The user ID
* @param int[] $iaf_ids attachment file id-s to attach
* @param boolean $internal_only Whether this attachment is supposed to be internal only or not
* @param string $file_description File description text
* @param string $unknown_user The email of the user who originally sent this email, who doesn't have an account.
* @param integer $associated_note_id The note ID that these attachments should be associated with
*/
public static function attachFiles($issue_id, $usr_id, $iaf_ids, $internal_only, $file_description, $unknown_user = null, $associated_note_id = null)
{
if (!$iaf_ids) {
throw new LogicException('No attachment ids');
}
$attachment_id = self::add($issue_id, $usr_id, $file_description, $internal_only, $unknown_user, $associated_note_id);
self::associateFiles($attachment_id, $iaf_ids);
Issue::markAsUpdated($issue_id, 'file uploaded');
History::add($issue_id, $usr_id, 'attachment_added', 'Attachment uploaded by {user}', array('user' => User::getFullName($usr_id)));
// if there is customer integration, mark last customer action
$prj_id = Issue::getProjectID($issue_id);
$has_crm = CRM::hasCustomerIntegration($prj_id);
$is_customer = User::getRoleByUser($usr_id, $prj_id) == User::ROLE_CUSTOMER;
if ($has_crm && $is_customer) {
Issue::recordLastCustomerAction($issue_id);
}
Workflow::handleAttachment($prj_id, $issue_id, $usr_id);
Notification::notify($issue_id, 'files', $attachment_id, $internal_only);
}