Exemplo n.º 1
0
 function getGoogleSyncClass($save_user_id, $event, $selected_calendar = '')
 {
     global $adb;
     $GoogleSync4You = new GoogleSync4You();
     $have_access_data = $GoogleSync4You->setAccessDataForUser($save_user_id, true);
     if ($have_access_data) {
         $GoogleSync4You->connectToGoogle();
         if ($GoogleSync4You->is_logged) {
             $GoogleSync4You->setEvent($event);
             if ($selected_calendar == '') {
                 $selected_calendar = $GoogleSync4You->getSCalendar(1);
             }
             $is_disabled = $GoogleSync4You->isDisabled(1);
             //export
             if (!$is_disabled && $selected_calendar != '') {
                 return $GoogleSync4You;
             }
         }
     }
     return false;
 }
Exemplo n.º 2
0
* The content of this file is subject to the Calendar4You Free license.
* ("License"); You may not use this file except in compliance with the License
* The Initial Developer of the Original Code is IT-Solutions4You s.r.o.
* Portions created by IT-Solutions4You s.r.o. are Copyright(C) IT-Solutions4You s.r.o.
* All Rights Reserved.
********************************************************************************/
include_once "modules/Calendar4You/GoogleSync4You.php";
require_once "modules/Calendar4You/Calendar4You.php";
require_once "modules/Calendar4You/CalendarUtils.php";
global $app_strings, $current_user, $current_language, $app_strings;
$eventid = $_REQUEST["eventid"];
$userid = $_REQUEST["userid"];
$geventid = $_REQUEST["geventid"];
$typeid = $_REQUEST["typeid"];
error_reporting(0);
$GoogleSync4You = new GoogleSync4You();
$GoogleSync4You->setAccessDataForUser($userid);
$GoogleSync4You->connectToGoogle();
if ($GoogleSync4You->isLogged()) {
    $add_into_vtiger = true;
    $c_time_zone = new DateTimeZone($current_user->time_zone);
    if ($current_user->hour_format == '') {
        $format = 'am/pm';
    } else {
        $format = $current_user->hour_format;
    }
    $c_mod_strings = return_specified_module_language($current_language, "Calendar");
    $event = $GoogleSync4You->getGoogleCalEvent($geventid);
    $recurrence = $event->recurrence;
    if ($recurrence != "") {
        $add_into_vtiger = false;
Exemplo n.º 3
0
<?php

/*********************************************************************************
 * The content of this file is subject to the Calendar4You Free license.
 * ("License"); You may not use this file except in compliance with the License
 * The Initial Developer of the Original Code is IT-Solutions4You s.r.o.
 * Portions created by IT-Solutions4You s.r.o. are Copyright(C) IT-Solutions4You s.r.o.
 * All Rights Reserved.
 ********************************************************************************/
include_once "modules/Calendar4You/GoogleSync4You.php";
global $current_user, $mod_strings;
$GoogleSync4You = new GoogleSync4You();
$apikey = $_REQUEST["apikey"];
$keyfile = $_REQUEST["keyfile"];
$clientid = $_REQUEST["clientid"];
$refresh = $_REQUEST["refresh_token"];
$googleinsert = $_REQUEST["googleinsert"];
$login = $_REQUEST["login"];
$pass = $_REQUEST["pass"];
$GoogleSync4You->setAccessData($current_user->id, $login, $apikey, $keyfile, $clientid, $refresh, $googleinsert);
$GoogleSync4You->connectToGoogle();
if ($GoogleSync4You->isLogged()) {
    $data["status"] = "ok";
    $data["text"] = $mod_strings["LBL_CONNECTING_WORK_CORRECT"];
} else {
    $data["status"] = "error";
    $data["text"] = $GoogleSync4You->getStatus();
}
echo json_encode($data);
Exemplo n.º 4
0
			</tr>
            </table>
            <input type="hidden" id="day_selected_fields" name="day_selected_fields">
            <input type="hidden" id="week_selected_fields" name="week_selected_fields">
            <input type="hidden" id="month_selected_fields" name="month_selected_fields">
            <?php 
}
?>
        </div>
        <!-- Google Cal Sync info -->
        <div id="TabEventGoogleCalSync" style="display: none; width: 100%;padding-top:10px;">
        <?php 
if ($google_sync_id) {
    $user_fullname = getITSUserFullName($current_user->id);
    require_once 'modules/Calendar4You/GoogleSync4You.php';
    $GoogleSync4You = new GoogleSync4You();
    $have_access_data = $GoogleSync4You->setAccessDataForUser($current_user->id);
    if ($have_access_data) {
        $GoogleSync4You->connectToGoogle();
        if (!$GoogleSync4You->is_logged) {
            echo $GoogleSync4You->getStatus();
        } else {
            $GoogleSync4You->setEvent($id);
            $selected_calendar = $GoogleSync4You->getSCalendar("1");
            echo $mod_strings["LBL_TO_GOOGLE_CALENDAR"] . ": ";
            $listFeed = $GoogleSync4You->getGoogleCalendars();
            echo "<select name='selected_calendar' onChange='showGoogleSyncAccDiv(this.value)'>";
            echo "<option value=''></option>";
            foreach ($listFeed as $calendar) {
                if ($calendar->id == $selected_calendar) {
                    $selected = "selected";
Exemplo n.º 5
0
		</tr>
		<tr><td colspan="2" style="border-bottom:1px dotted #CCCCCC;"></td></tr>
		<tr>
			<td align="right" valign="top"><img src="modules/Calendar4You/images/sync_icon.png" width="45" height="38" align="absmiddle"></td>
			<td align="left"><b>
			<?php 
echo $mod_strings["LBL_GOOGLE_SYNC_ACCESS_DATA"];
echo " &quot;" . trim($current_user->first_name . " " . $current_user->last_name) . "&quot;";
?>
			</b>
			<br /><br /><div id="google_sync_verifying" style="display:none;"><img src="themes/images/vtbusy.gif" align="absmiddle"><?php 
echo $mod_strings["LBL_GOOGLE_SYNC_CONTROL_ACCESS_DATA"];
?>
</div><div id="google_sync_text">
			<?php 
$GoogleSync4You = new GoogleSync4You();
$have_access_data = $GoogleSync4You->setAccessDataForUser($current_user->id);
if ($have_access_data) {
    $GoogleSync4You->connectToGoogle();
}
if (!$GoogleSync4You->isLogged()) {
    echo $GoogleSync4You->getStatus();
} else {
    echo $mod_strings["LBL_CONNECTING_WORK_CORRECT"];
}
$google_login = $GoogleSync4You->getclientsecret();
$google_apikey = $GoogleSync4You->getAPI();
$google_keyfile = $GoogleSync4You->getkeyfile();
$google_clientid = $GoogleSync4You->getclientid();
$google_refresh = $GoogleSync4You->getrefreshtoken();
$googleinsert = $GoogleSync4You->getgoogleinsert();
Exemplo n.º 6
0
    	</tr>
        <tr><td colspan="2" style="border-bottom:1px dotted #CCCCCC;"></td></tr>
    	<tr>
    		<td align="right" valign="top"><img src="modules/Calendar4You/images/sync_icon.png" width="45" height="38" align="absmiddle"></td>
    		<td align="left"><b>
             <?php 
echo $mod_strings["LBL_GOOGLE_SYNC_ACCESS_DATA"];
echo " &quot;" . trim($current_user->first_name . " " . $current_user->last_name) . "&quot;";
?>
        	</b>
            <br /><br /><div id="google_sync_verifying" style="display:none;"><img src="themes/images/vtbusy.gif" align="absmiddle"><?php 
echo $mod_strings["LBL_GOOGLE_SYNC_CONTROL_ACCESS_DATA"];
?>
</div><div id="google_sync_text">
            <?php 
$GoogleSync4You = new GoogleSync4You();
$GoogleSync4You->setAccessDataForUser($current_user->id);
$GoogleSync4You->connectToGoogle();
if (!$GoogleSync4You->isLogged()) {
    echo $GoogleSync4You->getStatus();
} else {
    echo $mod_strings["LBL_CONNECTING_WORK_CORRECT"];
}
$google_login = $GoogleSync4You->getLogin();
?>
            </div><br>
            <?php 
if ($google_login != "") {
    echo "<div id='google_account_info_div'>";
    echo getTranslatedString("LBL_LOGIN", "Users") . ":";
    echo $google_login;
Exemplo n.º 7
0
		</tr>
		<tr><td colspan="2" style="border-bottom:1px dotted #CCCCCC;"></td></tr>
		<tr>
			<td align="right" valign="top"><img src="modules/Calendar4You/images/sync_icon.png" width="45" height="38" align="absmiddle"></td>
			<td align="left"><b>
			<?php 
echo $mod_strings["LBL_GOOGLE_SYNC_ACCESS_DATA"];
echo " &quot;" . trim($current_user->first_name . " " . $current_user->last_name) . "&quot;";
?>
			</b>
			<br /><br /><div id="google_sync_verifying" style="display:none;"><img src="themes/images/vtbusy.gif" align="absmiddle"><?php 
echo $mod_strings["LBL_GOOGLE_SYNC_CONTROL_ACCESS_DATA"];
?>
</div><div id="google_sync_text">
			<?php 
$GoogleSync4You = new GoogleSync4You();
$have_access_data = $GoogleSync4You->setAccessDataForUser($current_user->id);
if ($have_access_data) {
    $GoogleSync4You->connectToGoogle();
}
if (!$GoogleSync4You->isLogged()) {
    echo $GoogleSync4You->getStatus();
} else {
    echo $mod_strings['LBL_CONNECTING_WORK_CORRECT'];
    echo '&nbsp;&nbsp;<a href="' . $GoogleSync4You->getAuthURL(true) . '">' . $mod_strings['LBL_CONNECT'] . '</a>';
}
$google_login = $GoogleSync4You->getclientsecret();
$google_apikey = $GoogleSync4You->getAPI();
$google_keyfile = $GoogleSync4You->getkeyfile();
$google_clientid = $GoogleSync4You->getclientid();
$google_refresh = $GoogleSync4You->getrefreshtoken();
Exemplo n.º 8
0
include_once "modules/Calendar4You/GoogleSync4You.php";
require_once "modules/Calendar4You/Calendar4You.php";
require_once "modules/Calendar4You/CalendarUtils.php";
global $adb, $current_user, $default_timezone;
$currentModule = "Calendar";
$controltime = strtotime("-6 month");
$controldate = date("Y-m-d", $controltime);
$c_time_zone = new DateTimeZone($default_timezone);
$where = "vtiger_activity.due_date > ? AND (vtiger_activity.status != 'Held' OR vtiger_activity.status IS NULL) AND (vtiger_activity.eventstatus != 'Held' OR vtiger_activity.eventstatus IS NULL)";
$sql1 = "SELECT userid FROM its4you_googlesync4you_events \n         INNER JOIN vtiger_activity \n            ON vtiger_activity.activityid = its4you_googlesync4you_events.crmid\n         WHERE " . $where . "\n         GROUP BY userid";
$result1 = $adb->pquery($sql1, array($controldate));
$num_rows1 = $adb->num_rows($result1);
if ($num_rows1 > 0) {
    while ($row1 = $adb->fetchByAssoc($result1)) {
        $userid = $row1["userid"];
        $GoogleSync4You = new GoogleSync4You();
        $have_access_data = $GoogleSync4You->setAccessDataForUser($userid);
        if ($have_access_data) {
            $GoogleSync4You->connectToGoogle();
            if ($GoogleSync4You->isLogged()) {
                $sql2 = "SELECT its4you_googlesync4you_events.*, vtiger_activity.activitytype FROM its4you_googlesync4you_events \n                     INNER JOIN vtiger_activity \n                        ON vtiger_activity.activityid = its4you_googlesync4you_events.crmid\n                     WHERE " . $where . " AND userid = ?";
                $result2 = $adb->pquery($sql2, array($controldate, $userid));
                while ($row2 = $adb->fetchByAssoc($result2)) {
                    $eventid = $row2["id"];
                    $lastmodified = $row2["lastmodified"];
                    $geventid = $row2["geventid"];
                    $event = $GoogleSync4You->getGoogleCalEvent($geventid);
                    if (!$event) {
                        $sql3 = "DELETE FROM its4you_googlesync4you_events WHERE id = ?";
                        $adb->pquery($sql3, array($eventid));
                    } else {
Exemplo n.º 9
0
<?php

/*********************************************************************************
 * The content of this file is subject to the Calendar4You Free license.
 * ("License"); You may not use this file except in compliance with the License
 * The Initial Developer of the Original Code is IT-Solutions4You s.r.o.
 * Portions created by IT-Solutions4You s.r.o. are Copyright(C) IT-Solutions4You s.r.o.
 * All Rights Reserved.
 ********************************************************************************/
include_once "modules/Calendar4You/GoogleSync4You.php";
global $current_user, $mod_strings;
$GoogleSync4You = new GoogleSync4You();
$login = $_REQUEST["login"];
$pass = $_REQUEST["pass"];
$GoogleSync4You->setAccessData($current_user->id, $login, $pass);
$GoogleSync4You->connectToGoogle();
if ($GoogleSync4You->isLogged()) {
    $data["status"] = "ok";
    $data["text"] = $mod_strings["LBL_CONNECTING_WORK_CORRECT"];
} else {
    $data["status"] = "error";
    $data["text"] = $GoogleSync4You->getStatus();
}
echo json_encode($data);