示例#1
0
文件: detail.php 项目: sQcrm/sqcrm
<?php

// Copyright SQCRM. For licensing, reuse, modification and distribution see license.txt
/**
* Detail page 
* @author Abhik Chakraborty
*/
$do_crmfields = new CRMFields();
$do_block = new Block();
$do_block->get_block_by_module($module_id);
$module_obj = new Calendar();
$module_obj->getId($sqcrm_record_id);
//updates detail, just add and last updated
$do_crmentity = new CRMEntity();
$update_history = $do_crmentity->get_last_updates($sqcrm_record_id, $module_id, $module_obj);
// Recurrent events info
$recurrent_events = new RecurrentEvents();
$recurrent_events_pattern = $recurrent_events->has_recurrent_events($sqcrm_record_id);
if (false !== $recurrent_events_pattern) {
    $recurrent_events_pattern = json_decode($recurrent_events_pattern, true);
}
$text_options = $recurrent_events->get_text_options();
$days_in_week = $recurrent_events->get_days_in_week();
//event reminder info
$do_events_reminder = new EventsReminder();
$reminder = $do_events_reminder->get_event_reminder($sqcrm_record_id);
if (isset($_GET['ajaxreq']) && $_GET['ajaxreq'] == true) {
    require_once 'view/detail_view_entry.php';
} else {
    require_once 'view/detail_view.php';
}
示例#2
0
文件: add.php 项目: sQcrm/sqcrm
    $related_to_id = (int) $_GET["related_to"];
    $related_to_module_id = (int) $_GET["related_to_module"];
    $module_info = $_SESSION["do_module"]->get_modules_with_full_info();
    $related_module_name = $module_info[$related_to_module_id]["name"];
    $cancel_return = NavigationControl::getNavigationLink($related_module_name, "detail", $related_to_id);
    if ($_SESSION["do_crm_action_permission"]->action_permitted('view', $related_to_module_id, $related_to_id) === true) {
        $add_from_related = true;
    } else {
        $show_add_page = false;
    }
} else {
    $cancel_return = NavigationControl::getNavigationLink($module, "list");
}
// set event start/end date time
$start_end_date = TimeZoneUtil::get_user_timezone_date();
$start_time = TimeZoneUtil::get_user_timezone_time();
$end_time = date("H:i:s", strtotime("+1 hour", strtotime($start_time)));
//Recurrent event info
$recurrent_events = new RecurrentEvents();
$text_options = $recurrent_events->get_text_options();
$days_in_week = $recurrent_events->get_days_in_week();
if ($show_add_page === true) {
    require_once 'view/calendar_add_view.php';
} else {
    echo '<div class="alert alert-danger" style="height:100px;margin-top:100px;margin-left:200px;margin-right:200px;">';
    echo '<h4>';
    echo _('Access Denied ! ');
    echo '</h4>';
    echo _('You are not authorized to perform this operation.');
    echo '</div>';
}
<?php 
// Copyright SQCRM. For licensing, reuse, modification and distribution see license.txt 
/**
* repeat event edit view for calendar
* @author Abhik Chakraborty
*/
?>
<div class="box_content">
	<div class="form-group">
		<input type="checkbox" id="event_repeat" name="event_repeat" checked>
		<b><?php echo _('Repeat'); ?></b>
    </div>
    <div id="recurrent_options_section" style="display:block;">
    <br />
		<?php
		$do_recurrent_events = new RecurrentEvents();
		$recurrent_options = $do_recurrent_events->get_recurrent_options();
		echo _('Frequencey');
		echo '<br />';
		echo '<select name="recurrent_options" id="recurrent_options">';
		foreach ($recurrent_options as $key=>$val) {
			$selected = '';
			if ($recurrent_events_pattern["recurrent_options"] == $key) $selected = "selected";
			echo '<option value="'.$key.'" '.$selected.'>'.$val.'</option>'."\n";
		}
		echo '</select>';
		?>
		<?php
		if ($recurrent_events_pattern["recurrent_options"] == 1 || $recurrent_events_pattern["recurrent_options"] == 5
        || $recurrent_events_pattern["recurrent_options"] == 6 || $recurrent_events_pattern["recurrent_options"] == 7
		) {
示例#4
0
 /**
  * Event function to update the data
  * @param object $evctl
  */
 public function eventEditRecord(EventControler $evctl)
 {
     $permission = $_SESSION["do_crm_action_permission"]->action_permitted('edit', 2, (int) $evctl->sqrecord);
     if (true === $permission) {
         $do_process_plugins = new CRMPluginProcessor();
         // process before update plugin. If any error is raised display that.
         $do_process_plugins->process_action_plugins((int) $evctl->idmodule, $evctl, 3, (int) $evctl->sqrecord, (object) $this->getId((int) $evctl->sqrecord));
         if (strlen($do_process_plugins->get_error()) > 2) {
             $_SESSION["do_crm_messages"]->set_message('error', $do_process_plugins->get_error());
             $next_page = NavigationControl::getNavigationLink($evctl->module, "edit");
             $dis = new Display($next_page);
             $dis->addParam("sqrecord", (int) $evctl->sqrecord);
             if ($evctl->return_page != '') {
                 $dis->addParam("return_page", $evctl->return_page);
             }
             $evctl->setDisplayNext($dis);
         } else {
             $do_crm_fields = new CRMFields();
             $fields = $do_crm_fields->get_field_information_by_module_as_array((int) $evctl->idmodule);
             // edit the event
             $idevents = $this->edit_event($evctl, $fields);
             if (false === $idevents) {
                 // if error re-direct
                 $next_page = $evctl->error_page;
                 $dis = new Display($next_page);
                 $evctl->setDisplayNext($dis);
             } else {
                 $do_recurrent_event = new RecurrentEvents();
                 $has_recurrent_events = $do_recurrent_event->has_recurrent_events($idevents);
                 if ($evctl->event_repeat == 'on') {
                     $recurrent_dates = $do_recurrent_event->get_recurrent_dates($evctl);
                     $recurrent_pattern = $do_recurrent_event->get_recurrent_event_pattern();
                     if (is_array($recurrent_dates) && count($recurrent_dates) > 0) {
                         $add_recurrent_events = false;
                         // if existing recurrent events found and its not eqaul to the submitted one
                         if (false !== $has_recurrent_events && trim(json_encode($recurrent_pattern)) != trim($has_recurrent_events)) {
                             $this->delete_related_recurrent_events($idevents);
                             $do_recurrent_event->delete_recurrent_pattern($idevents);
                             $add_recurrent_events = true;
                         } elseif ($has_recurrent_events === false) {
                             $add_recurrent_events = true;
                         }
                         if (true === $add_recurrent_events) {
                             foreach ($recurrent_dates as $recurrent_dates) {
                                 $idevents_rec = $this->add_events($evctl, $fields);
                                 $qry = "\n\t\t\t\t\t\t\t\t\tupdate " . $this->getTable() . " set \n\t\t\t\t\t\t\t\t\t`start_date` = ?, \n\t\t\t\t\t\t\t\t\t`end_date` = ?,\n\t\t\t\t\t\t\t\t\t`parent_recurrent_event_id` = ? \n\t\t\t\t\t\t\t\t\twhere `idevents` = ?";
                                 $stmt = $this->getDbConnection()->executeQuery($qry, array($recurrent_dates, $recurrent_dates, $idevents, $idevents_rec));
                             }
                             $this->insert('recurrent_events', array('idevents' => $idevents, 'recurrent_pattern' => json_encode($recurrent_pattern)));
                         }
                     }
                 } else {
                     if (false !== $recurrent_pattern) {
                         $this->delete_related_recurrent_events($idevents);
                         $do_recurrent_event->delete_recurrent_pattern($idevents);
                     }
                 }
                 // Event reminder
                 $do_events_reminder = new EventsReminder();
                 if ($evctl->event_alert == 'on') {
                     $do_events_reminder->update_event_reminder($idevents, $evctl);
                 } else {
                     if (false !== $do_events_reminder->get_event_reminder($idevents)) {
                         $do_events_reminder->delete_event_reminder($idevents);
                     }
                 }
                 // process after update plugin
                 $do_process_plugins->process_action_plugins((int) $evctl->idmodule, $evctl, 4, $idevents, (object) $this->getId($idevents));
                 $next_page = NavigationControl::getNavigationLink($evctl->module, "detail");
                 $dis = new Display($next_page);
                 $dis->addParam("sqrecord", $idevents);
                 $evctl->setDisplayNext($dis);
             }
         }
     } else {
         $_SESSION["do_crm_messages"]->set_message('error', _('You do not have permission to edit the record ! '));
         $next_page = NavigationControl::getNavigationLink($evctl->module, "list");
         $dis = new Display($next_page);
         $evctl->setDisplayNext($dis);
     }
 }