本文整理汇总了PHP中ApplicationLogs类的典型用法代码示例。如果您正苦于以下问题:PHP ApplicationLogs类的具体用法?PHP ApplicationLogs怎么用?PHP ApplicationLogs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ApplicationLogs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Show dashboard index page
*
* @param void
* @return null
*/
function index()
{
$logged_user = logged_user();
$active_projects = $logged_user->getActiveProjects();
$activity_log = null;
if (is_array($active_projects) && count($active_projects)) {
$include_private = $logged_user->isMemberOfOwnerCompany();
$include_silent = $logged_user->isAdministrator();
$project_ids = array();
foreach ($active_projects as $active_project) {
$project_ids[] = $active_project->getId();
}
// if
$activity_log = ApplicationLogs::getOverallLogs($include_private, $include_silent, $project_ids, config_option('dashboard_logs_count', 15));
}
// if
tpl_assign('today_milestones', $logged_user->getTodayMilestones());
tpl_assign('late_milestones', $logged_user->getLateMilestones());
tpl_assign('active_projects', $active_projects);
tpl_assign('activity_log', $activity_log);
// Sidebar
tpl_assign('online_users', Users::getWhoIsOnline());
tpl_assign('my_projects', $active_projects);
$this->setSidebar(get_template_path('index_sidebar', 'dashboard'));
}
开发者ID:ukd1,项目名称:Project-Pier,代码行数:31,代码来源:DashboardController.class.php
示例2: purge_trash
function purge_trash()
{
Env::useHelper("permissions");
$days = config_option("days_on_trash", 0);
$count = 0;
if ($days > 0) {
$date = DateTimeValueLib::now()->add("d", -$days);
$objects = Objects::findAll(array("conditions" => array("`trashed_by_id` > 0 AND `trashed_on` < ?", $date), "limit" => 100));
foreach ($objects as $object) {
$concrete_object = Objects::findObject($object->getId());
if (!$concrete_object instanceof ContentDataObject) {
continue;
}
if ($concrete_object instanceof MailContent && $concrete_object->getIsDeleted() > 0) {
continue;
}
try {
DB::beginWork();
if ($concrete_object instanceof MailContent) {
$concrete_object->delete(false);
} else {
$concrete_object->delete();
}
ApplicationLogs::createLog($concrete_object, ApplicationLogs::ACTION_DELETE);
DB::commit();
$count++;
} catch (Exception $e) {
DB::rollback();
Logger::log("Error delting object in purge_trash: " . $e->getMessage(), Logger::ERROR);
}
}
}
return $count;
}
开发者ID:rorteg,项目名称:fengoffice,代码行数:34,代码来源:Trash.class.php
示例3: index
/**
* Show dashboard index page
*
* @param void
* @return null
*/
function index()
{
trace(__FILE__, 'index() - begin');
$logged_user = logged_user();
$active_projects = $logged_user->getActiveProjects();
$activity_log = null;
$projects_activity_log = array();
if (is_array($active_projects) && count($active_projects)) {
$include_private = $logged_user->isMemberOfOwnerCompany();
$include_silent = $logged_user->isAdministrator();
$project_ids = array();
foreach ($active_projects as $active_project) {
$project_ids[] = $active_project->getId();
$temp_project_logs = ApplicationLogs::getProjectLogs($active_project, $include_private, $include_silent, config_option('dashboard_project_logs_count', 7));
if (isset($temp_project_logs) && is_array($temp_project_logs) && count($temp_project_logs)) {
$projects_activity_log[$temp_project_logs[0]->getCreatedOn()->getTimestamp()] = $temp_project_logs;
}
krsort($projects_activity_log);
}
// if
$activity_log = ApplicationLogs::getOverallLogs($include_private, $include_silent, $project_ids, config_option('dashboard_logs_count', 15));
}
// if
trace(__FILE__, 'index() - tpl_assign...');
tpl_assign('today_milestones', $logged_user->getTodayMilestones());
tpl_assign('late_milestones', $logged_user->getLateMilestones());
tpl_assign('active_projects', $active_projects);
tpl_assign('activity_log', $activity_log);
tpl_assign('projects_activity_log', $projects_activity_log);
// Sidebar
tpl_assign('online_users', Users::getWhoIsOnline());
tpl_assign('my_projects', $active_projects);
$this->setSidebar(get_template_path('index_sidebar', 'dashboard'));
trace(__FILE__, 'index() - end');
}
开发者ID:469306621,项目名称:Languages,代码行数:41,代码来源:DashboardController.class.php
示例4: delete
/**
* Delete specific user
*
* @access public
* @param void
* @return null
*/
function delete()
{
$this->setTemplate('del_user');
$user = Users::findById(get_id());
if (!$user instanceof User) {
flash_error(lang('user dnx'));
$this->redirectTo('administration');
}
// if
if (!$user->canDelete(logged_user())) {
flash_error(lang('no access permissions'));
$this->redirectToReferer(get_url('dashboard'));
}
// if
$delete_data = array_var($_POST, 'deleteUser');
tpl_assign('user', $user);
tpl_assign('delete_data', $delete_data);
if (!is_array($delete_data)) {
$delete_data = array('really' => 0, 'password' => '');
// array
tpl_assign('delete_data', $delete_data);
} else {
if ($delete_data['really'] == 1) {
$password = $delete_data['password'];
if (trim($password) == '') {
tpl_assign('error', new Error(lang('password value missing')));
return $this->render();
}
if (!logged_user()->isValidPassword($password)) {
tpl_assign('error', new Error(lang('invalid login data')));
return $this->render();
}
try {
DB::beginWork();
$user->delete();
ApplicationLogs::createLog($user, null, ApplicationLogs::ACTION_DELETE);
DB::commit();
flash_success(lang('success delete user', $user->getDisplayName()));
} catch (Exception $e) {
DB::rollback();
flash_error(lang('error delete user'));
}
// try
$this->redirectToUrl($user->getCompany()->getViewUrl());
} else {
flash_error(lang('error delete user'));
$this->redirectToUrl($user->getCompany()->getViewUrl());
}
}
}
开发者ID:bklein01,项目名称:Project-Pier,代码行数:57,代码来源:UserController.class.php
示例5: purge_trash
function purge_trash()
{
Env::useHelper("permissions");
$days = config_option("days_on_trash", 0);
$count = 0;
if ($days > 0) {
$date = DateTimeValueLib::now()->add("d", -$days);
$managers = array('Comments', 'Companies', 'Contacts', 'MailContents', 'ProjectCharts', 'ProjectEvents', 'ProjectFiles', 'ProjectFileRevisions', 'ProjectForms', 'ProjectMessages', 'ProjectMilestones', 'ProjectTasks', 'ProjectWebpages');
foreach ($managers as $manager_class) {
$manager = new $manager_class();
$prevcount = -1;
while ($prevcount != $count) {
$prevcount = $count;
if ($manager_class == 'MailContents') {
$objects = $manager->findAll(array("include_trashed" => true, "conditions" => array("`trashed_by_id` > 0 AND `trashed_on` < ? AND `is_deleted` = 0", $date), "limit" => 100));
} else {
$objects = $manager->findAll(array("include_trashed" => true, "conditions" => array("`trashed_by_id` > 0 AND `trashed_on` < ?", $date), "limit" => 100));
}
if (is_array($objects)) {
// delete one by one because each one knows what else to delete
foreach ($objects as $o) {
try {
DB::beginWork();
$ws = $o->getWorkspaces();
if ($o instanceof MailContent) {
$o->delete(false);
} else {
$o->delete();
}
ApplicationLogs::createLog($o, $ws, ApplicationLogs::ACTION_DELETE);
DB::commit();
$count++;
} catch (Exception $e) {
DB::rollback();
Logger::log("Error deleting object in purge_trash: " . $e->getMessage(), Logger::ERROR);
}
}
}
}
}
}
return $count;
}
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:43,代码来源:Trash.class.php
示例6: delete_comment
/**
* Delete comment
*
* @access public
* @param void
* @return null
*/
function delete_comment()
{
$comment = MessageComments::findById(get_id());
if (!$comment instanceof MessageComment) {
flash_error(lang('comment dnx'));
$this->redirectTo('message');
}
// if
$message = $comment->getMessage();
if (!$message instanceof ProjectMessage) {
flash_error(lang('message dnx'));
$this->redirectTo('message');
}
// if
if (!$comment->canDelete(logged_user())) {
flash_error(lang('no access permissions'));
$this->redirectToUrl($message->getViewUrl());
}
// if
try {
DB::beginWork();
$comment->delete();
ApplicationLogs::createLog($comment, active_project(), ApplicationLogs::ACTION_DELETE);
DB::commit();
flash_success(lang('success delete comment'));
} catch (Exception $e) {
DB::rollback();
flash_error(lang('error delete comment'));
}
// try
$this->redirectToUrl($message->getViewUrl());
}
开发者ID:ukd1,项目名称:Project-Pier,代码行数:39,代码来源:MessageController.class.php
示例7: manager
/**
* Return manager instance
*
* @access protected
* @param void
* @return ApplicationLogs
*/
function manager()
{
if (!$this->manager instanceof ApplicationLogs) {
$this->manager = ApplicationLogs::instance();
}
return $this->manager;
}
开发者ID:abhinay100,项目名称:feng_app,代码行数:14,代码来源:BaseApplicationLog.class.php
示例8: delete
/**
* Delete specific project form
*
* @param void
* @return null
*/
function delete()
{
$project_form = ProjectForms::findById(get_id());
if (!$project_form instanceof ProjectForm) {
flash_error(lang('project form dnx'));
if (ProjectForm::canAdd(logged_user(), active_project())) {
$this->redirectTo('form');
} else {
$this->redirectToUrl(active_project()->getOverviewUrl());
}
// if
}
// if
if (!$project_form->canDelete(logged_user())) {
flash_error(lang('no access permissions'));
if (ProjectForm::canAdd(logged_user(), active_project())) {
$this->redirectTo('form');
} else {
$this->redirectToUrl(active_project()->getOverviewUrl());
}
// if
}
// if
if ($project_form->delete()) {
ApplicationLogs::createLog($project_form, active_project(), ApplicationLogs::ACTION_DELETE, true);
flash_success(lang('success delete project form', $project_form->getName()));
} else {
flash_error(lang('error delete project form'));
}
// if
$this->redirectTo('form');
}
开发者ID:469306621,项目名称:Languages,代码行数:38,代码来源:FormController.class.php
示例9: project_activities
/**
* List project activities as a RSS feed
*
* @param void
* @return null
*/
function project_activities()
{
$this->setLayout('xml');
$logged_user = $this->loginUserByToken();
if (!$logged_user instanceof User) {
header("HTTP/1.0 404 Not Found");
die;
}
// if
$project = Projects::findById(array_var($_GET, 'project'));
if (!$project instanceof Project) {
header("HTTP/1.0 404 Not Found");
die;
}
// if
if (!$logged_user->isProjectUser($project)) {
header("HTTP/1.0 404 Not Found");
die;
}
// if
$include_private = $logged_user->isMemberOfOwnerCompany();
$include_silent = $logged_user->isAdministrator();
$activity_log = ApplicationLogs::getOverallLogs($include_private, $include_silent, array($project->getId()), config_option('feed_logs_count', 50));
$feed = new Angie_Feed(lang('recent project activities feed', $project->getName()), undo_htmlspecialchars($project->getOverviewUrl()));
$feed = $this->populateFeedFromLog($feed, $activity_log);
$this->renderText($feed->renderRSS2(), true);
}
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:33,代码来源:FeedController.class.php
示例10: delete
/**
* Delete specific comment
*
* @param void
* @return null
*/
function delete()
{
$comment = Comments::findById(get_id());
if (!$comment instanceof Comment) {
flash_error(lang('comment dnx'));
ajx_current("empty");
return;
}
// if
$object = $comment->getRelObject();
if (!$object instanceof ContentDataObject) {
flash_error(lang('object dnx'));
ajx_current("empty");
return;
}
// if
if (trim($object->getObjectUrl())) {
$redirect_to = $object->getObjectUrl();
}
if (!$comment->canDelete(logged_user())) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
// if
try {
DB::beginWork();
$comment->trash();
ApplicationLogs::createLog($comment, ApplicationLogs::ACTION_TRASH);
DB::commit();
flash_success(lang('success delete comment'));
ajx_current("reload");
} catch (Exception $e) {
DB::rollback();
flash_error(lang('error delete comment'));
ajx_current("empty");
}
// try
}
开发者ID:rorteg,项目名称:fengoffice,代码行数:45,代码来源:CommentController.class.php
示例11: delete_logo
/**
* Delete company logo
*
* @param void
* @return null
*/
function delete_logo()
{
if (!logged_user()->isAdministrator(owner_company())) {
flash_error(lang('no access permissions'));
$this->redirectTo('dashboard');
}
// if
$company = Companies::findById(get_id());
if (!$company instanceof Company) {
flash_error(lang('company dnx'));
$this->redirectToReferer(get_url('administration', 'clients'));
}
// if
try {
DB::beginWork();
$company->deleteLogo();
$company->save();
ApplicationLogs::createLog($company, null, ApplicationLogs::ACTION_EDIT);
DB::commit();
flash_success(lang('success delete company logo'));
} catch (Exception $e) {
DB::rollback();
flash_error(lang('error delete company logo'));
}
// try
$this->redirectToUrl($company->getEditLogoUrl());
}
开发者ID:ukd1,项目名称:Project-Pier,代码行数:33,代码来源:CompanyController.class.php
示例12: restore_user
function restore_user()
{
$user = Contacts::findById(get_id());
if (!($user instanceof Contact && $user->isUser())) {
flash_error(lang('user dnx'));
ajx_current("empty");
return;
}
if (!$user->canDelete(logged_user())) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
try {
DB::beginWork();
$user->setDisabled(false);
$user->unarchive();
ApplicationLogs::createLog($user, ApplicationLogs::ACTION_UNTRASH);
$ret = null;
Hook::fire("user_restored", $user, $ret);
DB::commit();
flash_success('success delete user');
ajx_current("reload");
} catch (Exception $e) {
flash_error($e->getMessage());
DB::rollback();
ajx_current("empty");
}
}
开发者ID:rorteg,项目名称:fengoffice,代码行数:29,代码来源:AccountController.class.php
示例13: setIsPrivateForType
/**
* Mass set is_private for a given type. If $ids is present limit update only to object with given ID-s
*
* @param boolean $is_private
* @param string $type
* @parma array $ids
* @return boolean
*/
static function setIsPrivateForType($is_private, $type, $ids = null)
{
$limit_ids = null;
if (is_array($ids)) {
$limit_ids = array();
foreach ($ids as $id) {
$limit_ids[] = DB::escape($id);
}
// if
$limit_ids = count($limit_ids) > 0 ? implode(',', $limit_ids) : null;
}
// if
$sql = DB::prepareString('UPDATE ' . ApplicationLogs::instance()->getTableName(true) . ' SET `is_private` = ? WHERE `rel_object_manager` = ?', array($is_private, $type));
if ($limit_ids !== null) {
$sql .= " AND `rel_object_id` IN ({$limit_ids})";
}
// if
return DB::execute($sql);
}
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:27,代码来源:ApplicationLogs.class.php
示例14: delete_chart
function delete_chart()
{
if (logged_user()->isGuest()) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
$chart = ProjectCharts::findById(get_id());
if (!$chart instanceof ProjectChart) {
flash_error(lang('chart dnx'));
ajx_current("empty");
return;
}
// if
if (!$chart->canDelete(logged_user())) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
// if
try {
DB::beginWork();
$chart->trash();
ApplicationLogs::createLog($chart, $chart->getWorkspaces(), ApplicationLogs::ACTION_TRASH);
DB::commit();
flash_success(lang('success deleted chart', $chart->getTitle()));
ajx_current("back");
} catch (Exception $e) {
DB::rollback();
flash_error(lang('error delete chart'));
ajx_current("empty");
}
// try
}
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:34,代码来源:ReportingController.class.php
示例15: repetitive_task_related_edit
function repetitive_task_related_edit($task, $task_data)
{
$was_template = $task->getIsTemplate();
$task->setFromAttributes($task_data);
$task->setIsTemplate($was_template);
// is_template value must not be changed from ui
$totalMinutes = array_var($task_data, 'time_estimate_hours') * 60 + array_var($task_data, 'time_estimate_minutes');
$task->setTimeEstimate($totalMinutes);
if ($task->getParentId() > 0 && $task->hasChild($task->getParentId())) {
flash_error(lang('task child of child error'));
ajx_current("empty");
return;
}
DB::beginWork();
$task->save();
$task->setObjectName(array_var($task_data, 'name'));
$task->save();
// dependencies
if (config_option('use tasks dependencies')) {
$previous_tasks = array_var($task_data, 'previous');
if (is_array($previous_tasks)) {
foreach ($previous_tasks as $ptask) {
if ($ptask == $task->getId()) {
continue;
}
$dep = ProjectTaskDependencies::findById(array('previous_task_id' => $ptask, 'task_id' => $task->getId()));
if (!$dep instanceof ProjectTaskDependency) {
$dep = new ProjectTaskDependency();
$dep->setPreviousTaskId($ptask);
$dep->setTaskId($task->getId());
$dep->save();
}
}
$saved_ptasks = ProjectTaskDependencies::findAll(array('conditions' => 'task_id = ' . $task->getId()));
foreach ($saved_ptasks as $pdep) {
if (!in_array($pdep->getPreviousTaskId(), $previous_tasks)) {
$pdep->delete();
}
}
} else {
ProjectTaskDependencies::delete('task_id = ' . $task->getId());
}
}
// Add assigned user to the subscibers list
if ($task->getAssignedToContactId() > 0 && Contacts::instance()->findById($task->getAssignedToContactId())) {
if (!isset($_POST['subscribers'])) {
$_POST['subscribers'] = array();
}
$_POST['subscribers']['user_' . $task->getAssignedToContactId()] = 'checked';
}
$object_controller = new ObjectController();
$object_controller->add_to_members($task, array_var($task_data, 'members'));
$object_controller->add_subscribers($task);
$object_controller->link_to_new_object($task);
$object_controller->add_custom_properties($task);
$object_controller->add_reminders($task);
// apply values to subtasks
$assigned_to = $task->getAssignedToContactId();
$subtasks = $task->getAllSubTasks();
$milestone_id = $task->getMilestoneId();
$apply_ms = array_var($task_data, 'apply_milestone_subtasks') == "checked";
$apply_at = array_var($task_data, 'apply_assignee_subtasks', '') == "checked";
foreach ($subtasks as $sub) {
$modified = false;
if ($apply_at || !($sub->getAssignedToContactId() > 0)) {
$sub->setAssignedToContactId($assigned_to);
$modified = true;
}
if ($apply_ms) {
$sub->setMilestoneId($milestone_id);
$modified = true;
}
if ($modified) {
$sub->save();
}
}
$task->resetIsRead();
ApplicationLogs::createLog($task, ApplicationLogs::ACTION_EDIT);
DB::commit();
}
开发者ID:rorteg,项目名称:fengoffice,代码行数:80,代码来源:TaskController.class.php
示例16: setstatus
/**
* Set the status for marked time items
*
* @access public
* @param void
* @return null
*/
function setstatus()
{
if (!logged_user()->isAdministrator(owner_company())) {
flash_error(lang('no access permissions'));
$this->redirectTo('dashboard');
}
// if
$status = array_var($_GET, 'status') ? array_var($_GET, 'status') : 0;
$new_status = abs($status - 1);
$new_status_text = $new_status ? 'billed' : 'unbilled';
$items = array_var($_POST, 'item');
$redirect_to = array_var($_GET, 'redirect_to');
if ($redirect_to == '') {
$redirect_to = get_url('administration', 'time', array('status' => $status));
$redirect_to = str_replace('&', '&', trim($redirect_to));
}
// if
if (is_array($items) && count($items)) {
foreach ($items as $id => $status) {
$time = ProjectTimes::findById($id);
if (!$time instanceof ProjectTime) {
flash_error(lang('time dnx'));
$this->redirectToUrl($redirect_to);
}
// if
$time->setIsClosed($new_status);
try {
DB::beginWork();
$time->save();
ApplicationLogs::createLog($time, $time->getProject(), ApplicationLogs::ACTION_EDIT);
DB::commit();
} catch (Exception $e) {
DB::rollback();
flash_error('There was an error changing the status of one of your items.');
$this->redirectToUrl($redirect_to);
}
// try
}
// foreach
flash_success('Items successfully marked as ' . $new_status_text);
}
// if
$this->redirectToUrl($redirect_to);
}
开发者ID:469306621,项目名称:Languages,代码行数:51,代码来源:TimeController.class.php
示例17: unarchive
function unarchive()
{
if (!can_manage_dimension_members(logged_user())) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
$member = Members::findById(get_id());
if (!$member instanceof Member) {
flash_error(lang('member dnx'));
ajx_current("empty");
return;
}
if (get_id('user')) {
$user = Contacts::findById($get_id('user'));
} else {
$user = logged_user();
}
if (!$user instanceof Contact) {
ajx_current("empty");
return;
}
try {
DB::beginWork();
set_time_limit(0);
$count = $member->unarchive($user);
evt_add("reload dimension tree", array('dim_id' => $member->getDimensionId()));
if (array_var($_REQUEST, 'dont_back')) {
ajx_current("empty");
} else {
ajx_current("back");
}
flash_success(lang('success unarchive member', $member->getName(), $count));
DB::commit();
ApplicationLogs::createLog($member, ApplicationLogs::ACTION_UNARCHIVE);
} catch (Exception $e) {
DB::rollback();
flash_error($e->getMessage());
ajx_current("empty");
}
}
开发者ID:abhinay100,项目名称:feng_app,代码行数:41,代码来源:MemberController.class.php
示例18: list_all
function list_all()
{
ajx_current("empty");
$context = active_context();
$start = array_var($_GET, 'start', 0);
$limit = array_var($_GET, 'limit', config_option('files_per_page'));
$order = array_var($_GET, 'sort');
if ($order == "updatedOn" || $order == "updated" || $order == "date" || $order == "dateUpdated") {
$order = "updated_on";
}
$order_dir = array_var($_GET, 'dir');
$page = (int) ($start / $limit) + 1;
$hide_private = !logged_user()->isMemberOfOwnerCompany();
if (array_var($_GET, 'action') == 'delete') {
$ids = explode(',', array_var($_GET, 'webpages'));
$succ = 0;
$err = 0;
foreach ($ids as $id) {
$web_page = ProjectWebpages::findById($id);
if (isset($web_page) && $web_page->canDelete(logged_user())) {
try {
DB::beginWork();
$web_page->trash();
ApplicationLogs::createLog($web_page, ApplicationLogs::ACTION_TRASH);
DB::commit();
$succ++;
} catch (Exception $e) {
DB::rollback();
$err++;
}
} else {
$err++;
}
}
if ($succ > 0) {
flash_success(lang("success delete objects", $succ));
}
if ($err > 0) {
flash_error(lang("error delete objects", $err));
}
} else {
if (array_var($_GET, 'action') == 'markasread') {
$ids = explode(',', array_var($_GET, 'ids'));
$succ = 0;
$err = 0;
foreach ($ids as $id) {
$webpage = ProjectWebpages::findById($id);
try {
$webpage->setIsRead(logged_user()->getId(), true);
$succ++;
} catch (Exception $e) {
$err++;
}
}
if ($succ <= 0) {
flash_error(lang("error markasread files", $err));
}
} else {
if (array_var($_GET, 'action') == 'markasunread') {
$ids = explode(',', array_var($_GET, 'ids'));
$succ = 0;
$err = 0;
foreach ($ids as $id) {
$webpage = ProjectWebpages::findById($id);
try {
$webpage->setIsRead(logged_user()->getId(), false);
$succ++;
} catch (Exception $e) {
$err++;
}
}
if ($succ <= 0) {
flash_error(lang("error markasunread files", $err));
}
} else {
if (array_var($_GET, 'action') == 'archive') {
$ids = explode(',', array_var($_GET, 'webpages'));
$succ = 0;
$err = 0;
foreach ($ids as $id) {
$web_page = ProjectWebpages::findById($id);
if (isset($web_page) && $web_page->canEdit(logged_user())) {
try {
DB::beginWork();
$web_page->archive();
ApplicationLogs::createLog($web_page, ApplicationLogs::ACTION_ARCHIVE);
DB::commit();
$succ++;
} catch (Exception $e) {
DB::rollback();
$err++;
}
} else {
$err++;
}
}
if ($succ > 0) {
flash_success(lang("success archive objects", $succ));
}
if ($err > 0) {
//.........这里部分代码省略.........
开发者ID:rorteg,项目名称:fengoffice,代码行数:101,代码来源:WebpageController.class.php
示例19: add_objects_to_member
/**
* Used for Drag & Drop, adds objects to a member
* @author alvaro
*/
function add_objects_to_member()
{
$ids = json_decode(array_var($_POST, 'objects'));
$mem_id = array_var($_POST, 'member');
if (!is_array($ids) || count($ids) == 0) {
ajx_current("empty");
return;
}
$member = Members::findById($mem_id);
try {
DB::beginWork();
$objects = array();
$from = array();
foreach ($ids as $oid) {
/* @var $obj ContentDataObject */
$obj = Objects::findObject($oid);
$dim_obj_type_content = DimensionObjectTypeContents::findOne(array('conditions' => array('`dimension_id`=? AND `dimension_object_type_id`=? AND `content_object_type_id`=?', $member->getDimensionId(), $member->getObjectTypeId(), $obj->getObjectTypeId())));
if (!$dim_obj_type_content instanceof DimensionObjectTypeContent) {
continue;
}
if (!$dim_obj_type_content->getIsMultiple() || array_var($_POST, 'remove_prev')) {
$db_res = DB::execute("SELECT group_concat(om.member_id) as old_members FROM " . TABLE_PREFIX . "object_members om INNER JOIN " . TABLE_PREFIX . "members m ON om.member_id=m.id WHERE m.dimension_id=" . $member->getDimensionId() . " AND om.object_id=" . $obj->getId());
$row = $db_res->fetchRow();
if (array_var($row, 'old_members') != "") {
$from[$obj->getId()] = $row['old_members'];
}
// remove from previous members
ObjectMembers::delete('`object_id` = ' . $obj->getId() . ' AND `member_id` IN (SELECT `m`.`id` FROM `' . TABLE_PREFIX . 'members` `m` WHERE `m`.`dimension_id` = ' . $member->getDimensionId() . ')');
}
$obj->addToMembers(array($member));
$obj->addToSharingTable();
$objects[] = $obj;
}
DB::commit();
// add to application logs
foreach ($objects as $object) {
$action = array_var($from, $obj->getId()) ? ApplicationLogs::ACTION_MOVE : ApplicationLogs::ACTION_COPY;
$log_data = (array_var($from, $obj->getId()) ? "from:" . array_var($from, $obj->getId()) . ";" : "") . "to:" . $member->getId();
ApplicationLogs::instance()->createLog($object, $action, false, true, true, $log_data);
}
$lang_key = count($ids) > 1 ? 'objects moved to member success' : 'object moved to member success';
flash_success(lang($lang_key, $member->getName()));
if (array_var($_POST, 'reload')) {
ajx_current('reload');
} else {
ajx_current('empty');
}
} catch (Exception $e) {
DB::rollback();
ajx_current("empty");
flash_error(lang('unable to move objects'));
}
}
开发者ID:rorteg,项目名称:fengoffice,代码行数:57,代码来源:MemberController.class.php
示例20: delete
/**
* Delete project
*
* @param void
* @return null
*/
function delete()
{
if (logged_user()->isGuest()) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
$pid = get_id();
$u = Users::findOne(array("conditions" => "personal_project_id = {$pid}"));
if ($u) {
//flash_error("id: $pid, u: ".$u->getId());
ajx_current("empty");
flash_error(lang('cannot delete personal project'));
return;
//$this->redirectTo('administration', 'projects');
}
$project = Projects::findById(get_id());
if (!$project instanceof Project) {
flash_error(lang('project dnx'));
ajx_current("empty");
return;
//$this->redirectTo('administration', 'projects');
}
// if
if (!$project->canDelete(logged_user())) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
//$this->redirectToReferer(get_url('administration', 'projects'));
}
// if
if (!array_var($_GET, 'confirm')) {
tpl_assign('project', $project);
$this->setTemplate('pre_delete');
return;
}
ajx_current("empty");
try {
$id = $project->getId();
$name = $project->getName();
DB::beginWork();
$project->delete();
CompanyWebsite::instance()->setProject(null);
ApplicationLogs::createLog($project, null, ApplicationLogs::ACTION_DELETE);
DB::commit();
flash_success(lang('success delete project', $project->getName()));
evt_add("workspace deleted", array("id" => $id, "name" => $name));
ajx_current("start");
} catch (Exception $e) {
DB::rollback();
flash_error($e->getMessage());
ajx_current("empty");
}
// try
//$this->redirectTo('administration', 'projects');
}
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:62,代码来源:ProjectController.class.php
注:本文中的ApplicationLogs类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论