当前位置: 首页>>代码示例>>PHP>>正文


PHP DateTimeValueLib::make方法代码示例

本文整理汇总了PHP中DateTimeValueLib::make方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeValueLib::make方法的具体用法?PHP DateTimeValueLib::make怎么用?PHP DateTimeValueLib::make使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DateTimeValueLib的用法示例。


在下文中一共展示了DateTimeValueLib::make方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: edit

 /**
  * Show and process edit milestone form
  *
  * @access public
  * @param void
  * @return null
  */
 function edit()
 {
     $this->setTemplate('add_milestone');
     $milestone = ProjectMilestones::findById(get_id());
     if (!$milestone instanceof ProjectMilestone) {
         flash_error(lang('milestone dnx'));
         $this->redirectTo('milestone', 'index');
     }
     // if
     if (!$milestone->canEdit(logged_user())) {
         flash_error(lang('no access permissions'));
         $this->redirectToReferer(get_url('milestone'));
     }
     $milestone_data = array_var($_POST, 'milestone');
     if (!is_array($milestone_data)) {
         $tag_names = $milestone->getTagNames();
         $milestone_data = array('name' => $milestone->getName(), 'due_date' => $milestone->getDueDate(), 'description' => $milestone->getDescription(), 'assigned_to' => $milestone->getAssignedToCompanyId() . ':' . $milestone->getAssignedToUserId(), 'tags' => is_array($tag_names) ? implode(', ', $tag_names) : '', 'is_private' => $milestone->isPrivate());
         // array
     }
     // if
     tpl_assign('milestone_data', $milestone_data);
     tpl_assign('milestone', $milestone);
     if (is_array(array_var($_POST, 'milestone'))) {
         $old_owner = $milestone->getAssignedTo();
         // remember the old owner
         $milestone_data['due_date'] = DateTimeValueLib::make(0, 0, 0, array_var($_POST, 'milestone_due_date_month', 1), array_var($_POST, 'milestone_due_date_day', 1), array_var($_POST, 'milestone_due_date_year', 1970));
         $assigned_to = explode(':', array_var($milestone_data, 'assigned_to', ''));
         $old_is_private = $milestone->isPrivate();
         $milestone->setFromAttributes($milestone_data);
         if (!logged_user()->isMemberOfOwnerCompany()) {
             $milestone->setIsPrivate($old_is_private);
         }
         $milestone->setProjectId(active_project()->getId());
         $milestone->setAssignedToCompanyId(array_var($assigned_to, 0, 0));
         $milestone->setAssignedToUserId(array_var($assigned_to, 1, 0));
         try {
             DB::beginWork();
             $milestone->save();
             $milestone->setTagsFromCSV(array_var($milestone_data, 'tags'));
             ApplicationLogs::createLog($milestone, active_project(), ApplicationLogs::ACTION_EDIT);
             DB::commit();
             // If owner is changed send notification but don't break submission
             try {
                 $new_owner = $milestone->getAssignedTo();
                 if (array_var($milestone_data, 'send_notification') == 'checked') {
                     if ($old_owner instanceof User) {
                         // We have a new owner and it is different than old owner
                         if ($new_owner instanceof User && $new_owner->getId() != $old_owner->getId()) {
                             Notifier::milestoneAssigned($milestone);
                         }
                     } else {
                         // We have new owner
                         if ($new_owner instanceof User) {
                             Notifier::milestoneAssigned($milestone);
                         }
                     }
                     // if
                 }
                 // if
             } catch (Exception $e) {
             }
             // try
             flash_success(lang('success edit milestone', $milestone->getName()));
             $this->redirectTo('milestone');
         } catch (Exception $e) {
             DB::rollback();
             tpl_assign('error', $e);
         }
         // try
     }
     // if
 }
开发者ID:ukd1,项目名称:Project-Pier,代码行数:79,代码来源:MilestoneController.class.php

示例2: total_task_times_by_task_print

 function total_task_times_by_task_print()
 {
     $this->setLayout("html");
     $task = ProjectTasks::findById(get_id());
     $st = DateTimeValueLib::make(0, 0, 0, 1, 1, 1900);
     $et = DateTimeValueLib::make(23, 59, 59, 12, 31, 2036);
     $timeslotsArray = Timeslots::getTaskTimeslots(null, null, null, $st, $et, get_id());
     tpl_assign('estimate', $task->getTimeEstimate());
     //tpl_assign('timeslots', $timeslots);
     tpl_assign('timeslotsArray', $timeslotsArray);
     tpl_assign('workspace', $task->getProject());
     tpl_assign('template_name', 'total_task_times');
     tpl_assign('title', lang('task time report'));
     tpl_assign('task_title', $task->getTitle());
     $this->setTemplate('report_printer');
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:16,代码来源:ReportingController.class.php

示例3: user_config_option

$date_format = user_config_option('date_format');
if ($use_24_hours) {
    $timeformat = 'G:i';
} else {
    $timeformat = 'g:i A';
}
echo stylesheet_tag('event/day.css');
//today in gmt 0
$today = DateTimeValueLib::now();
//user today
//	$today->add('h', logged_user()->getTimezone());
$currentday = $today->format("j");
$currentmonth = $today->format("n");
$currentyear = $today->format("Y");
$drawHourLine = $day == $currentday && $month == $currentmonth && $year == $currentyear;
$dtv = DateTimeValueLib::make(0, 0, 0, $month, $day, $year);
$result = ProjectEvents::getDayProjectEvents($dtv, active_context(), $user_filter, $status_filter);
if (!$result) {
    $result = array();
}
$alldayevents = array();
$milestones = ProjectMilestones::getRangeMilestones($dtv, $dtv);
if ($task_filter != "hide") {
    $tasks = ProjectTasks::getRangeTasksByUser($dtv, $dtv, $user_filter != -1 ? $user : null, $task_filter);
}
if (user_config_option('show_birthdays_in_calendar')) {
    $birthdays = Contacts::instance()->getRangeContactsByBirthday($dtv, $dtv, active_context_members(false));
} else {
    $birthdays = array();
}
foreach ($result as $key => $event) {
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:31,代码来源:viewdate.php

示例4: lang

	</div>	
	<div id="trap9"><fieldset id="fs9" style="height:0px;border:0px;padding:0px;display:none"><span style="color:#FFFFFF;"></span></fieldset></div>

<div>
<fieldset><legend><?php 
echo lang('CAL_TIME_AND_DURATION');
?>
</legend>
<table>
	<tr style="padding-bottom:4px">
		<td align="right" style="padding-right:10px;padding-bottom:6px;padding-top:2px"><?php 
echo lang('CAL_DATE');
?>
</td>
		<td align='left'><?php 
$dv_start = DateTimeValueLib::make(array_var($event_data, 'hour'), array_var($event_data, 'minute'), 0, $month, $day, $year);
$event->setStart($dv_start);
echo pick_date_widget2('event[start_value]', $event->getStart(), $genid, 120);
?>
		</td>
	</tr>

	<tr style="padding-bottom:4px">
		<td align="right" style="padding-right:10px;padding-bottom:6px;padding-top:2px">
			<?php 
echo lang('CAL_TIME');
?>
		</td>
		<td>
		<?php 
$hr = array_var($event_data, 'hour');
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:31,代码来源:event.php

示例5: edit

 /**
  * Show and process edit time form
  *
  * @access public
  * @param void
  * @return null
  */
 function edit()
 {
     $this->setTemplate('add_time');
     $time = ProjectTimes::findById(get_id());
     if (!$time instanceof ProjectTime) {
         flash_error(lang('time dnx'));
         $this->redirectTo('time', 'index');
     }
     // if
     if (!$time->canEdit(logged_user())) {
         flash_error(lang('no access permissions'));
         $this->redirectToReferer(get_url('time'));
     }
     $time_data = array_var($_POST, 'time');
     if (!is_array($time_data)) {
         $time_data = array('name' => $time->getName(), 'hours' => $time->getHours(), 'is_billable' => $time->getBillable(), 'done_date' => $time->getDoneDate(), 'description' => $time->getDescription(), 'assigned_to' => $time->getAssignedToCompanyId() . ':' . $time->getAssignedToUserId(), 'is_private' => $time->isPrivate(), 'task_id' => $time->getTaskId(), 'task_list_id' => $time->getTaskListId());
         // array
     }
     // if
     tpl_assign('time_data', $time_data);
     tpl_assign('time', $time);
     // Attiks - BEGIN
     tpl_assign('open_task_lists', active_project()->getOpenTaskLists());
     // Attiks - END
     if (is_array(array_var($_POST, 'time'))) {
         $old_owner = $time->getAssignedTo();
         // remember the old owner
         if (isset($_POST['time_done_date'])) {
             $time_data['done_date'] = DateTimeValueLib::makeFromString($_POST['time_done_date']);
         } else {
             $time_data['done_date'] = DateTimeValueLib::make(0, 0, 0, array_var($_POST, 'time_done_date_month', 1), array_var($_POST, 'time_done_date_day', 1), array_var($_POST, 'time_done_date_year', 1970));
         }
         // Attiks - BEGIN
         if (isset($time_data['task_id'])) {
             if (substr($time_data['task_id'], 0, 5) == 'task_') {
                 $time_data['task_id'] = substr($time_data['task_id'], 5);
                 $t = ProjectTasks::findById($time_data['task_id']);
                 if (!$t instanceof ProjectTask) {
                     flash_error(lang('task dnx'));
                     $this->redirectTo('task');
                 }
                 // if
                 $time_data['task_list_id'] = $t->getTaskListId();
             } else {
                 $time_data['task_list_id'] = $time_data['task_id'];
                 $time_data['task_id'] = null;
             }
         }
         // Attiks - END
         $assigned_to = explode(':', array_var($time_data, 'assigned_to', ''));
         $old_is_private = $time->isPrivate();
         $time->setFromAttributes($time_data);
         if (!logged_user()->isMemberOfOwnerCompany()) {
             $time->setIsPrivate($old_is_private);
         }
         $time->setProjectId(active_project()->getId());
         $time->setAssignedToCompanyId(array_var($assigned_to, 0, 0));
         $time->setAssignedToUserId(array_var($assigned_to, 1, 0));
         try {
             DB::beginWork();
             $time->save();
             ApplicationLogs::createLog($time, active_project(), ApplicationLogs::ACTION_EDIT);
             DB::commit();
             flash_success(lang('success edit time', $time->getName()));
             $this->redirectTo('time');
         } catch (Exception $e) {
             DB::rollback();
             tpl_assign('error', $e);
         }
         // try
     }
     // if
 }
开发者ID:469306621,项目名称:Languages,代码行数:80,代码来源:TimeController.class.php

示例6: idate

            $ld = idate('d', mktime(0, 0, 0, $month_aux, 0, $year_aux));
            //date("t", strtotime("last month",mktime(0,0,0,$month-1,1,$year)));
            $w = $ld + $day_of_month;
            $dtv = DateTimeValueLib::make(0, 0, 0, $month_aux, $day_of_month, $year_aux);
        } else {
            if ($day_of_month == $lastday + 1) {
                $month_aux++;
                if ($month_aux == 13) {
                    $month_aux = 1;
                    $year_aux++;
                }
            }
            $p = get_url('event', 'viewdate', array('day' => $day_of_month - $lastday, 'month' => $month_aux, 'year' => $year_aux, 'view_type' => 'viewdate'));
            $t = get_url('event', 'add', array('day' => $day_of_month - $lastday, 'month' => $month_aux, 'year' => $year_aux));
            $w = $day_of_month - $lastday;
            $dtv = DateTimeValueLib::make(0, 0, 0, $month_aux, $w, $year_aux);
        }
        $start_value = $dtv->format(user_config_option('date_format'));
        ?>
	
						 		<div id="m<?php 
        echo $dtv->getMonth();
        ?>
_d<?php 
        echo $dtv->getDay();
        ?>
" style='z-index:0; min-height:90px; height:100%; cursor:pointer;<?php 
        echo $extra_style;
        ?>
'
						 		<?php 
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:31,代码来源:calendar.php

示例7: getTaskListsByMonth

    /**
    * Return array of milestones for the month specified that the user has
    * access to.
    *
    * @access public
    * @param int $year
    * @param int $month
    * @return array
    */
    function getTaskListsByMonth($year, $month) {
      $from_date = DateTimeValueLib::make(0, 0, 0, $month, 1, $year);
      $to_date = new DateTimeValue(strtotime('+1 month -1 day', $from_date->getTimestamp()));

      if (logged_user()->isMemberOfOwnerCompany()) {
        $conditions = array('`project_id` = ? AND (`due_date` >= ? AND `due_date` < ?)', $this->getId(), $from_date, $to_date);
      } else {
        $conditions = array('`project_id` = ? AND (`due_date` >= ? AND `due_date` < ?) AND `is_private` = ?', $this->getId(), $from_date, $to_date, 0);
      }
      return ProjectTaskLists::findAll(array(
        'conditions' => $conditions,
        'order' => 'due_date'
      )); // findAll
    } // getMilestonesByMonth
开发者ID:rjv,项目名称:Project-Pier,代码行数:23,代码来源:Project.class.php

示例8: edit

 /**
  * Show and process edit milestone form
  *
  * @access public
  * @param void
  * @return null
  */
 function edit()
 {
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $this->setTemplate('add_milestone');
     $milestone = ProjectMilestones::findById(get_id());
     if (!$milestone instanceof ProjectMilestone) {
         flash_error(lang('milestone dnx'));
         ajx_current("empty");
         return;
     }
     // if
     if (!$milestone->canEdit(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $milestone_data = array_var($_POST, 'milestone');
     if (!is_array($milestone_data)) {
         $tag_names = $milestone->getTagNames();
         $milestone_data = array('name' => $milestone->getName(), 'due_date' => $milestone->getDueDate(), 'description' => $milestone->getDescription(), 'assigned_to' => $milestone->getAssignedToCompanyId() . ':' . $milestone->getAssignedToUserId(), 'tags' => is_array($tag_names) ? implode(', ', $tag_names) : '', 'is_private' => $milestone->isPrivate(), 'is_urgent' => $milestone->getIsUrgent());
         // array
     }
     // if
     tpl_assign('milestone_data', $milestone_data);
     tpl_assign('milestone', $milestone);
     if (is_array(array_var($_POST, 'milestone'))) {
         if (array_var($milestone_data, 'due_date_value') != '') {
             $milestone_data['due_date'] = getDateValue(array_var($milestone_data, 'due_date_value'));
         } else {
             $now = DateTimeValueLib::now();
             $milestone_data['due_date'] = DateTimeValueLib::make(0, 0, 0, $now->getMonth(), $now->getDay(), $now->getYear());
         }
         $old_owner = $milestone->getAssignedTo();
         // remember the old owner
         $assigned_to = explode(':', array_var($milestone_data, 'assigned_to', ''));
         $old_is_private = $milestone->isPrivate();
         $milestone->setFromAttributes($milestone_data);
         $urgent = array_var($milestone_data, 'is_urgent') == 'checked';
         $milestone->setIsUrgent($urgent);
         if (!logged_user()->isMemberOfOwnerCompany()) {
             $milestone->setIsPrivate($old_is_private);
         }
         $old_project_id = $milestone->getProjectId();
         $project_id = array_var($_POST, 'ws_ids');
         if ($old_project_id != $project_id) {
             $newProject = Projects::findById($project_id);
             if (!$milestone->canAdd(logged_user(), $newProject)) {
                 flash_error(lang('no access permissions'));
                 ajx_current("empty");
                 return;
             }
             // if
             $milestone->move_inconsistent_tasks($newProject);
         }
         $milestone->setAssignedToCompanyId(array_var($assigned_to, 0, 0));
         $milestone->setAssignedToUserId(array_var($assigned_to, 1, 0));
         try {
             DB::beginWork();
             $milestone->save();
             $milestone->setTagsFromCSV(array_var($milestone_data, 'tags'));
             $object_controller = new ObjectController();
             $object_controller->add_to_workspaces($milestone);
             $object_controller->link_to_new_object($milestone);
             $object_controller->add_subscribers($milestone);
             $object_controller->add_custom_properties($milestone);
             $object_controller->add_reminders($milestone);
             ApplicationLogs::createLog($milestone, $milestone->getWorkspaces(), ApplicationLogs::ACTION_EDIT);
             DB::commit();
             // If owner is changed send notification but don't break submission
             try {
                 $new_owner = $milestone->getAssignedTo();
                 if (array_var($milestone_data, 'send_notification') == 'checked') {
                     if ($old_owner instanceof User) {
                         // We have a new owner and it is different than old owner
                         if ($new_owner instanceof User && $new_owner->getId() != $old_owner->getId()) {
                             Notifier::milestoneAssigned($milestone);
                         }
                     } else {
                         // We have new owner
                         if ($new_owner instanceof User) {
                             Notifier::milestoneAssigned($milestone);
                         }
                     }
                     // if
                 }
                 // if
             } catch (Exception $e) {
             }
             // try
//.........这里部分代码省略.........
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:101,代码来源:MilestoneController.class.php

示例9: edit_task

 /**
  * Edit task
  *
  * @access public
  * @param void
  * @return null
  */
 function edit_task()
 {
     $this->setTemplate('add_task');
     $task = ProjectTasks::findById(get_id());
     if (!$task instanceof ProjectTask) {
         flash_error(lang('task dnx'));
         $this->redirectTo('task');
     }
     // if
     $task_list = $task->getTaskList();
     if (!$task_list instanceof ProjectTaskList) {
         flash_error('task list dnx');
         $this->redirectTo('task');
     }
     // if
     if (!$task->canEdit(logged_user())) {
         flash_error(lang('no access permissions'));
         $this->redirectTo('task');
     }
     // if
     $task_data = array_var($_POST, 'task');
     if (!is_array($task_data)) {
         $task_data = array('text' => $task->getText(), 'start_date' => $task->getStartDate(), 'due_date' => $task->getDueDate(), 'task_list_id' => $task->getTaskListId(), 'assigned_to' => $task->getAssignedToCompanyId() . ':' . $task->getAssignedToUserId(), 'send_notification' => config_option('send_notification_default', '0'));
         // array
     }
     // if
     tpl_assign('task', $task);
     tpl_assign('task_list', $task_list);
     tpl_assign('task_data', $task_data);
     if (is_array(array_var($_POST, 'task'))) {
         $old_owner = $task->getAssignedTo();
         //$task_data['due_date'] = DateTimeValueLib::make(0, 0, 0, array_var($_POST, 'task_due_date_month', 1), array_var($_POST, 'task_due_date_day', 1), array_var($_POST, 'task_due_date_year', 1970));
         if (isset($_POST['task_start_date'])) {
             $task_data['start_date'] = DateTimeValueLib::makeFromString($_POST['task_start_date']);
         } else {
             $task_data['start_date'] = DateTimeValueLib::make(0, 0, 0, array_var($_POST, 'task_start_date_month', 1), array_var($_POST, 'task_start_date_day', 1), array_var($_POST, 'task_start_date_year', 1970));
         }
         if (isset($_POST['task_due_date'])) {
             $task_data['due_date'] = DateTimeValueLib::makeFromString($_POST['task_due_date']);
         } else {
             $task_data['due_date'] = DateTimeValueLib::make(0, 0, 0, array_var($_POST, 'task_due_date_month', 1), array_var($_POST, 'task_due_date_day', 1), array_var($_POST, 'task_due_date_year', 1970));
         }
         $task->setFromAttributes($task_data);
         $task->setTaskListId($task_list->getId());
         // keep old task list id
         $assigned_to = explode(':', array_var($task_data, 'assigned_to', ''));
         $task->setAssignedToCompanyId(array_var($assigned_to, 0, 0));
         $task->setAssignedToUserId(array_var($assigned_to, 1, 0));
         try {
             DB::beginWork();
             $task->save();
             // Move?
             $new_task_list_id = (int) array_var($task_data, 'task_list_id');
             if ($new_task_list_id && $task->getTaskListId() != $new_task_list_id) {
                 // Move!
                 $new_task_list = ProjectTaskLists::findById($new_task_list_id);
                 if ($new_task_list instanceof ProjectTaskList) {
                     $task_list->detachTask($task, $new_task_list);
                     // detach from old and attach to new list
                 }
                 // if
             }
             // if
             ApplicationLogs::createLog($task, active_project(), ApplicationLogs::ACTION_EDIT);
             DB::commit();
             trace(__FILE__, 'edit_task: notify user');
             // notify user
             if (array_var($task_data, 'send_notification') == 'checked') {
                 try {
                     if (Notifier::notifyNeeded($task->getAssignedTo(), $old_owner)) {
                         Notifier::taskAssigned($task);
                     }
                 } catch (Exception $e) {
                     Logger::log("Error: Notification failed, " . $e->getMessage(), Logger::ERROR);
                 }
                 // try
             }
             // if
             flash_success(lang('success edit task'));
             // Redirect to task list. Check if we have updated task list ID first
             if (isset($new_task_list) && $new_task_list instanceof ProjectTaskList) {
                 $this->redirectToUrl($new_task_list->getViewUrl());
             } else {
                 $this->redirectToUrl($task_list->getViewUrl());
             }
             // if
         } catch (Exception $e) {
             DB::rollback();
             tpl_assign('error', $e);
         }
         // try
     }
     // if
//.........这里部分代码省略.........
开发者ID:bklein01,项目名称:Project-Pier,代码行数:101,代码来源:TaskController.class.php

示例10: total_task_times_by_task_print

 function total_task_times_by_task_print()
 {
     $this->setLayout("html");
     $task = ProjectTasks::findById(get_id());
     $st = DateTimeValueLib::make(0, 0, 0, 1, 1, 1900);
     $et = DateTimeValueLib::make(23, 59, 59, 12, 31, 2036);
     $timeslotsArray = Timeslots::getTaskTimeslots(active_context(), null, null, $st, $et, get_id());
     tpl_assign('columns', array());
     tpl_assign('user', array());
     tpl_assign('group_by', array());
     tpl_assign('grouped_timeslots', array());
     tpl_assign('template_name', 'total_task_times');
     tpl_assign('estimate', $task->getTimeEstimate());
     tpl_assign('timeslotsArray', $timeslotsArray);
     tpl_assign('title', lang('task time report'));
     tpl_assign('task_title', $task->getTitle());
     tpl_assign('start_time', $st);
     tpl_assign('end_time', $et);
     $this->setTemplate('report_printer');
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:20,代码来源:ReportingController.class.php

示例11: getData


//.........这里部分代码省略.........
					break;
				case "2":
					$repeat_d = $jump;
					if(isset($forever) && $forever == 1) $oend = null;
					else $oend = $rend;
					break;
				case "3":
					$repeat_d = 7 * $jump;
					if(isset($forever) && $forever == 1) $oend = null;
					else $oend = $rend;
					break;
				case "4":
					$repeat_m = $jump;
					if(isset($forever) && $forever == 1) $oend = null;
					else $oend = $rend;
					break;
				case "5":
					$repeat_y = $jump;
					if(isset($forever) && $forever == 1) $oend = null;
					else $oend = $rend;
					break;
				case "6":
					$repeat_h = 1;
					$repeat_h_params = array(
						'dow' => array_var($event_data, 'repeat_dow'), 
						'wnum' => array_var($event_data, 'repeat_wnum'),
						'mjump' => array_var($event_data, 'repeat_mjump'),
					);
					break;
			}
			$repeat_number = $rnum;
			
		 	// get duration
			$durationhour = array_var($event_data,'durationhour');
			$durationmin = array_var($event_data,'durationmin');
			
			// get event type:  2=full day, 3=time/duratin not specified, 4=time not specified
			$typeofevent = array_var($event_data,'type_id');
			if(!is_numeric($typeofevent) OR ($typeofevent!=1 AND $typeofevent!=2 AND $typeofevent!=3)) $typeofevent = 1;

			if ($durationhour == 0 && $durationmin < 15 && $typeofevent != 2) {
				throw new Exception(lang('duration must be at least 15 minutes'));
			}
				
			// calculate timestamp and durationstamp
			$dt_start = new DateTimeValue(mktime($hour, $minute, 0, $month, $day, $year) - logged_user()->getTimezone() * 3600);
			$timestamp = $dt_start->format('Y-m-d H:i:s');
			$dt_duration = DateTimeValueLib::make($dt_start->getHour() + $durationhour, $dt_start->getMinute() + $durationmin, 0, $dt_start->getMonth(), $dt_start->getDay(), $dt_start->getYear());
			$durationstamp = $dt_duration->format('Y-m-d H:i:s');
			
			// organize the data expected by the query function
			$data = array();
			$data['repeat_num'] = $rnum;
			$data['repeat_h'] = $repeat_h;
			$data['repeat_dow'] = $repeat_h_params['dow'];
			$data['repeat_wnum'] = $repeat_h_params['wnum'];
			$data['repeat_mjump'] = $repeat_h_params['mjump'];
			$data['repeat_d'] = $repeat_d;
			$data['repeat_m'] = $repeat_m;
			$data['repeat_y'] = $repeat_y;
			$data['repeat_forever'] = $forever;
			$data['repeat_end'] =  $oend;
			$data['start'] = $timestamp;
			$data['name'] =  array_var($event_data,'name');
			$data['description'] =  array_var($event_data,'description');
			$data['type_id'] = $typeofevent;
			$data['duration'] = $durationstamp;
			
			$data['users_to_invite'] = array();
			// options when creating an event through a POP UP
			if (array_var($_POST, 'popup')){
				$user_filter = user_config_option('calendar user filter');
				if ($user_filter == '0' || $user_filter == '-1') {
					$user_filter = logged_user()->getId();
				}
				$data['users_to_invite'][$user_filter] = 0;
				if ($user_filter != logged_user()->getId() && user_config_option('autoassign_events')){
					$data['users_to_invite'][logged_user()->getId()] = 1;
				}
			}

			$compstr = 'invite_user_';
			foreach ($event_data as $k => $v) {
				if (str_starts_with($k, $compstr) && ($v == 'checked' || $v == 'on')) {
					$data['users_to_invite'][substr($k, strlen($compstr))] = 0; // Pending Answer
				}
			}
			
			if (isset($event_data['confirmAttendance'])) {
				$data['confirmAttendance'] = array_var($event_data, 'confirmAttendance');
			}			
			
			if (isset($event_data['send_notification'])) {
				$data['send_notification'] = array_var($event_data,'send_notification') == 'checked';
			}
			if (isset($event_data['subscribe_invited'])) {
				$data['subscribe_invited'] = array_var($event_data,'subscribe_invited') == 'checked';
			}
			return $data;
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:EventController.class.php

示例12: edit

	/**
	 * Show and process edit milestone form
	 *
	 * @access public
	 * @param void
	 * @return null
	 */
	function edit() {
		if (logged_user()->isGuest()) {
			flash_error(lang('no access permissions'));
			ajx_current("empty");
			return;
		}
		$this->setTemplate('add_milestone');

		$milestone = ProjectMilestones::findById(get_id());
		if(!($milestone instanceof ProjectMilestone)) {
			flash_error(lang('milestone dnx'));
			ajx_current("empty");
			return;
		} // if

		if(!$milestone->canEdit(logged_user())) {
			flash_error(lang('no access permissions'));
			ajx_current("empty");
			return;
		}

		$milestone_data = array_var($_POST, 'milestone');
		if(!is_array($milestone_data)) {
			$milestone_data = array(
	          'name'        => $milestone->getObjectName(),
	          'due_date'    => $milestone->getDueDate(),
	          'description' => $milestone->getDescription(),
	          'is_urgent' 	=> $milestone->getIsUrgent()
			); // array
		} // if

		tpl_assign('milestone_data', $milestone_data);
		tpl_assign('milestone', $milestone);

		if(is_array(array_var($_POST, 'milestone'))) {
			if (array_var($milestone_data, 'due_date_value') != ''){
				$milestone_data['due_date'] = getDateValue(array_var($milestone_data, 'due_date_value'));
			} else {
				$now = DateTimeValueLib::now();
				$milestone_data['due_date'] = DateTimeValueLib::make(0, 0, 0, $now->getMonth(), $now->getDay(), $now->getYear());
			}
			
			$milestone->setFromAttributes($milestone_data);
			$urgent = array_var($milestone_data, 'is_urgent') == 'checked';
			$milestone->setIsUrgent($urgent);

			try {
				$member_ids = json_decode(array_var($_POST, 'members'));
				
				DB::beginWork();
				$milestone->save();
				
				$object_controller = new ObjectController();
				$object_controller->add_to_members($milestone, $member_ids);
			    $object_controller->add_subscribers($milestone);
			    $object_controller->link_to_new_object($milestone);
				$object_controller->add_custom_properties($milestone);
				$object_controller->add_reminders($milestone);
			    
				ApplicationLogs::createLog($milestone, ApplicationLogs::ACTION_EDIT);
				DB::commit();

				flash_success(lang('success edit milestone', $milestone->getObjectName()));
				ajx_current("back");

			} catch(Exception $e) {
				DB::rollback();
				flash_error($e->getMessage());
				ajx_current("empty");
			} // try
		} // if
	} // edit
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:79,代码来源:MilestoneController.class.php

示例13: render_member_selectors

    render_member_selectors($event->manager()->getObjectTypeId(), $genid, null, array('select_current_context' => true, 'listeners' => $listeners), null, null, false);
} else {
    render_member_selectors($event->manager()->getObjectTypeId(), $genid, $event->getMemberIds(), array('listeners' => $listeners), null, null, false);
}
?>
		  </div>
		  
		  
		  <div class="dataBlock" style="clear: both;">
			<?php 
echo label_tag(lang('CAL_DATE'));
?>
			<?php 
$tmph = array_var($event_data, 'hour') == -1 ? 0 : array_var($event_data, 'hour');
$tmpm = array_var($event_data, 'minute') == -1 ? 0 : array_var($event_data, 'minute');
$dv_start = DateTimeValueLib::make($tmph, $tmpm, 0, $month, $day, $year);
$event->setStart($dv_start);
echo pick_date_widget2('event[start_value]', $event->getStart(), $genid, 120);
?>
		  </div>
		  <div class="clear"></div>
		  
		  <div class="dataBlock">
			<?php 
echo label_tag(lang('CAL_TIME'));
?>
			<?php 
$hr = array_var($event_data, 'hour');
$minute = array_var($event_data, 'minute');
$is_pm = array_var($event_data, 'pm');
$time_val = "{$hr}:" . str_pad($minute, 2, '0') . ($use_24_hours ? '' : ' ' . ($is_pm ? 'PM' : 'AM'));
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:31,代码来源:event.php

示例14: edit

 /**
  * Show and process edit milestone form
  *
  * @access public
  * @param void
  * @return null
  */
 function edit()
 {
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $this->setTemplate('add_milestone');
     if (array_var($_REQUEST, "template_milestone")) {
         $milestone = TemplateMilestones::findById(get_id());
         $this->setTemplate(get_template_path('add_template_milestone', 'template_milestone'));
         if (!$milestone instanceof TemplateMilestone) {
             flash_error(lang('milestone dnx'));
             ajx_current("empty");
             return;
         }
         // if
     } else {
         $milestone = ProjectMilestones::findById(get_id());
         if (!$milestone instanceof ProjectMilestone) {
             flash_error(lang('milestone dnx'));
             ajx_current("empty");
             return;
         }
         // if
     }
     if (!$milestone->canEdit(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $milestone_data = array_var($_POST, 'milestone');
     if (!is_array($milestone_data)) {
         // set layout for modal form
         if (array_var($_REQUEST, 'modal')) {
             $this->setLayout("json");
             tpl_assign('modal', true);
         }
         $milestone_data = array('name' => $milestone->getObjectName(), 'due_date' => $milestone->getDueDate(), 'description' => $milestone->getDescription(), 'is_urgent' => $milestone->getIsUrgent());
         // array
     }
     // if
     tpl_assign('milestone_data', $milestone_data);
     tpl_assign('milestone', $milestone);
     if (is_array(array_var($_POST, 'milestone'))) {
         if (array_var($milestone_data, 'due_date_value') != '') {
             $milestone_data['due_date'] = getDateValue(array_var($milestone_data, 'due_date_value'));
         } else {
             $now = DateTimeValueLib::now();
             $milestone_data['due_date'] = DateTimeValueLib::make(0, 0, 0, $now->getMonth(), $now->getDay(), $now->getYear());
         }
         $milestone->setFromAttributes($milestone_data);
         $urgent = array_var($milestone_data, 'is_urgent');
         $milestone->setIsUrgent($urgent);
         try {
             $member_ids = json_decode(array_var($_POST, 'members'));
             DB::beginWork();
             $milestone->save();
             $object_controller = new ObjectController();
             $object_controller->add_to_members($milestone, $member_ids);
             $object_controller->add_subscribers($milestone);
             $object_controller->link_to_new_object($milestone);
             $object_controller->add_custom_properties($milestone);
             $object_controller->add_reminders($milestone);
             DB::commit();
             ApplicationLogs::createLog($milestone, ApplicationLogs::ACTION_EDIT);
             //Send Template milestone to view
             if ($milestone instanceof TemplateMilestone) {
                 $object = array("action" => "edit", "object_id" => $milestone->getObjectId(), "type" => $milestone->getObjectTypeName(), "id" => $milestone->getId(), "name" => $milestone->getObjectName(), "ico" => "ico-milestone", "manager" => get_class($milestone->manager()));
                 evt_add("template object added", array('object' => $object));
             }
             $is_template = $milestone instanceof TemplateMilestone;
             if (array_var($_REQUEST, 'modal')) {
                 ajx_current("empty");
                 $this->setLayout("json");
                 $this->setTemplate(get_template_path("empty"));
                 // reload milestone info because plugins may have updated some task info (for example: name prefix)
                 if ($is_template) {
                     $milestone = TemplateMilestones::findById($milestone->getId());
                     $params = array('msg' => lang('success edit milestone', $milestone->getObjectName()), 'milestone' => $milestone->getArrayInfo(), 'reload' => array_var($_REQUEST, 'reload'));
                     if ($milestone instanceof TemplateMilestone) {
                         $params = $object;
                     }
                     print_modal_json_response($params, true, array_var($_REQUEST, 'use_ajx'));
                 } else {
                     $milestone = ProjectMilestones::findById($milestone->getId());
                     flash_success(lang('success edit milestone', $milestone->getObjectName()));
                     evt_add("reload current panel");
                 }
             } else {
                 if ($milestone instanceof TemplateMilestone) {
                     flash_success(lang('success edit template', $milestone->getObjectName()));
                 } else {
//.........这里部分代码省略.........
开发者ID:abhinay100,项目名称:feng_app,代码行数:101,代码来源:MilestoneController.class.php


注:本文中的DateTimeValueLib::make方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。