Пример #1
0
 public static function renderContactList(CAppUI $AppUI, array $contactList)
 {
     $output = '<table cellspacing="1" cellpadding="2" border="0" width="100%" class="tbl">';
     $output .= '<tr><th>' . $AppUI->_('Name') . '</th><th>' . $AppUI->_('Email') . '</th>';
     $output .= '<th>' . $AppUI->_('Phone') . '</th><th>' . $AppUI->_('Department') . '</th></tr>';
     foreach ($contactList as $contact_id => $contact_data) {
         $contact = new CContact();
         $contact->contact_id = $contact_id;
         $output .= '<tr>';
         $output .= '<td class="hilite"><a href="index.php?m=contacts&amp;a=addedit&amp;contact_id=' . $contact_id . '">' . $contact_data['contact_order_by'] . '</a></td>';
         $output .= '<td class="hilite">' . w2p_email($contact_data['contact_email']) . '</td>';
         $output .= '<td class="hilite">' . $contact_data['contact_phone'] . '</td>';
         $output .= '<td class="hilite">' . $contact_data['dept_name'] . '</td>';
         $output .= '</tr>';
     }
     $output .= '</table>';
     return $output;
 }
Пример #2
0
 /**
  *
  * @param CAppUI $AppUI
  * @param CProject $projectId
  *
  * The point of this function is to create/update a task to represent a
  *   subproject.
  *
  */
 public static function storeTokenTask(CAppUI $AppUI, $project_id)
 {
     $subProject = new CProject();
     $subProject->load($project_id);
     if ($subProject->project_id != $subProject->project_parent) {
         $q = new w2p_Database_Query();
         $q->addTable('tasks');
         $q->addQuery('MIN(task_start_date) AS min_task_start_date');
         $q->addQuery('MAX(task_end_date) AS max_task_end_date');
         $q->addWhere('task_project = ' . $subProject->project_id);
         $projectDates = $q->loadList();
         $q->clear();
         $q->addTable('tasks');
         $q->addQuery('task_id');
         $q->addWhere('task_represents_project = ' . $subProject->project_id);
         $task_id = $q->loadResult();
         $task = new CTask();
         if ($task_id) {
             $task->load($task_id);
         } else {
             $task->task_description = $task->task_name;
             $task->task_priority = $subProject->project_priority;
             $task->task_project = $subProject->project_parent;
             $task->task_represents_project = $subProject->project_id;
             $task->task_owner = $AppUI->user_id;
         }
         $task->task_name = $AppUI->_('Subproject') . ': ' . $subProject->project_name;
         $task->task_duration_type = 1;
         $task->task_duration = $subProject->getTotalProjectHours();
         $task->task_start_date = $projectDates[0]['min_task_start_date'];
         $task->task_end_date = $projectDates[0]['max_task_end_date'];
         $task->task_percent_complete = $subProject->project_percent_complete;
         $result = $task->store($AppUI);
         //TODO: we should do something with this store result?
     }
 }
Пример #3
0
function clash_cancel(CAppUI $AppUI)
{
    global $a;
    $a = $_SESSION['add_event_caller'];
    clear_clash();
    $AppUI->setMsg($AppUI->_('Event Cancelled'), UI_MSG_ALERT);
    $AppUI->redirect();
}
Пример #4
0
function clash_suggest(CAppUI $AppUI, $cal_sdf)
{
    global $m, $a;
    $obj = new CEvent();
    $obj->bind($_SESSION['add_event_post']);
    $start_date = new w2p_Utilities_Date($obj->event_start_date);
    $end_date = new w2p_Utilities_Date($obj->event_end_date);
    $df = $AppUI->getPref('SHDATEFORMAT');
    $start_secs = $start_date->getTime();
    $end_secs = $end_date->getTime();
    $duration = (int) (($end_secs - $start_secs) / 60);
    $titleBlock = new CTitleBlock('Suggest Alternative Event Time', 'myevo-appointments.png', $m, $m . '.' . $a);
    $titleBlock->show();
    $calurl = W2P_BASE_URL . '/index.php?m=calendar&a=clash&event_id=' . $obj->event_id;
    $times = array();
    $t = new w2p_Utilities_Date();
    $t->setTime(0, 0, 0);
    if (!defined('LOCALE_TIME_FORMAT')) {
        define('LOCALE_TIME_FORMAT', '%I:%M %p');
    }
    for ($m = 0; $m < 60; $m++) {
        $times[$t->format('%H%M%S')] = $t->format(LOCALE_TIME_FORMAT);
        $t->addSeconds(1800);
    }
    ?>
    <script language="javascript" type="text/javascript">
    function setDate( frm_name, f_date ) {
        fld_date = eval( 'document.' + frm_name + '.' + f_date );
        fld_real_date = eval( 'document.' + frm_name + '.' + 'event_' + f_date );
        if (fld_date.value.length>0) {
          if ((parseDate(fld_date.value))==null) {
                alert('The Date/Time you typed does not match your prefered format, please retype.');
                fld_real_date.value = '';
                fld_date.style.backgroundColor = 'red';
            } else {
                fld_real_date.value = formatDate(parseDate(fld_date.value), 'yyyyMMdd');
                fld_date.value = formatDate(parseDate(fld_date.value), '<?php 
    echo $cal_sdf;
    ?>
');
                fld_date.style.backgroundColor = '';
            }
        } else {
            fld_real_date.value = '';
        }
    }

    function set_clash_action(action) {
        document.editFrm.clash_action.value = action;
        document.editFrm.submit();
    }

    </script>
    <form name="editFrm" method="post" action="<?php 
    echo $calurl . '&clash_action=process';
    ?>
" accept-charset="utf-8">
    <table width='100%' class='std'>
    <tr>
      <td width='50%' align='right'><?php 
    echo $AppUI->_('Earliest Date');
    ?>
:</td>
      <td width='50%' align='left' nowrap="nowrap">
        <input type="hidden" name="event_start_date" id="event_start_date" value="<?php 
    echo $start_date ? $start_date->format(FMT_TIMESTAMP_DATE) : '';
    ?>
" />
        <input type="text" name="start_date" id="start_date" onchange="setDate('editFrm', 'start_date');" value="<?php 
    echo $start_date ? $start_date->format($df) : '';
    ?>
" class="text" />
        <a href="javascript: void(0);" onclick="return showCalendar('start_date', '<?php 
    echo $df;
    ?>
', 'editFrm', null, true)">
        <img src="<?php 
    echo w2PfindImage('calendar.gif');
    ?>
" width="24" height="12" alt="<?php 
    echo $AppUI->_('Calendar');
    ?>
" border="0" />
          </a>
      </td>
    </tr>
    <tr>
      <td width='50%' align='right'><?php 
    echo $AppUI->_('Latest Date');
    ?>
:</td>
      <td width='50%' align='left' nowrap="nowrap">
        <input type="hidden" name="event_end_date" id="event_end_date" value="<?php 
    echo $end_date ? $end_date->format(FMT_TIMESTAMP_DATE) : '';
    ?>
" />
        <input type="text" name="end_date" id="end_date" onchange="setDate('editFrm', 'end_date');" value="<?php 
    echo $end_date ? $end_date->format($df) : '';
    ?>
" class="text" />
        <a href="javascript: void(0);" onclick="return showCalendar('end_date', '<?php 
    echo $df;
    ?>
', 'editFrm', null, true)">
        <img src="<?php 
    echo w2PfindImage('calendar.gif');
    ?>
" width="24" height="12" alt="<?php 
    echo $AppUI->_('Calendar');
    ?>
" border="0" />
          </a>
      </td>
    </tr>
    <tr>
      <td width='50%' align='right'><?php 
    echo $AppUI->_('Earliest Start Time');
    ?>
:</td>
      <td width='50%' align='left'>
        <?php 
    echo arraySelect($times, 'start_time', 'size="1" class="text"', $start_date->format('%H%M%S'));
    ?>
      </td>
    </tr>
    <tr>
      <td width='50%' align='right'><?php 
    echo $AppUI->_('Latest Finish Time');
    ?>
:</td>
      <td width='50%' align='left'>
        <?php 
    echo arraySelect($times, 'end_time', 'size="1" class="text"', $end_date->format('%H%M%S'));
    ?>
      </td>
    </tr>
    <tr>
      <td width='50%' align='right'><?php 
    echo $AppUI->_('Duration');
    ?>
:</td>
      <td width='50%' align='left'>
        <input type="text" class="text" size="5" name="duration" value="<?php 
    echo $duration;
    ?>
" />
        <?php 
    echo $AppUI->_('minutes');
    ?>
      </td>
    </tr>
    <tr>
      <td><input type="button" value="<?php 
    echo $AppUI->_('cancel');
    ?>
" class="button" onclick="set_clash_action('cancel');" /></td>
      <td align="right"><input type="button" value="<?php 
    echo $AppUI->_('submit');
    ?>
" class="button" onclick="set_clash_action('process')" /></td>
    </tr>
    </table>
    <input type='hidden' name='clash_action' value='cancel' />
    </form>
    <?php 
}
Пример #5
0
/* $Id$ $URL$ */
require_once 'base.php';
require_once W2P_BASE_DIR . '/includes/config.php';
if (!isset($GLOBALS['OS_WIN'])) {
    $GLOBALS['OS_WIN'] = stristr(PHP_OS, 'WIN') !== false;
}
// tweak for pathname consistence on windows machines
require_once W2P_BASE_DIR . '/includes/main_functions.php';
require_once W2P_BASE_DIR . '/includes/db_adodb.php';
require_once W2P_BASE_DIR . '/classes/query.class.php';
require_once W2P_BASE_DIR . '/classes/ui.class.php';
$AppUI = new CAppUI();
include_once W2P_BASE_DIR . '/classes/w2p.class.php';
require_once W2P_BASE_DIR . '/classes/date.class.php';
if (w2PgetConfig('activate_external_user_creation') != 'true') {
    echo $AppUI->_('You should not access this file directly');
    die;
}
$uistyle = 'web2project';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<title><?php 
echo $AppUI->_('New User Signup');
?>
</title>
		<meta http-equiv="Content-Type" content="text/html;charset=<?php 
echo 'UTF-8';
?>
Пример #6
0
<?php

/* $Id$ $URL$ */
require_once 'base.php';
require_once W2P_BASE_DIR . '/includes/config.php';
require_once W2P_BASE_DIR . '/includes/main_functions.php';
require_once W2P_BASE_DIR . '/includes/db_adodb.php';
require_once W2P_BASE_DIR . '/classes/ui.class.php';
$AppUI = new CAppUI();
$updatekey = w2PgetParam($_POST, 'updatekey', 0);
$contact_id = (int) CContact::getContactByUpdatekey($updatekey);
if (!$contact_id) {
    echo $AppUI->_('You are not authorized to use this page. If you should be authorized please contact the sender to give you another valid link, thank you.');
    exit;
}
$contact = new CContact();
if (!$contact->bind($_POST)) {
    $msg = $AppUI->_('There was an error recording your contact data, please contact the system administrator. Thank you very much.');
} else {
    $result = $contact->store($AppUI);
    if (is_array($result)) {
        $msg = $AppUI->_('There was an error recording your contact data, please contact the system administrator. Thank you very much.');
    } else {
        $custom_fields = new w2p_Core_CustomFields('contacts', 'addedit', $contact->contact_id, 'edit', 1);
        $custom_fields->bind($_POST);
        $custom_fields->store($contact->contact_id);
        $contact->clearUpdateKey();
        $msg = $AppUI->_('Your contact data has been recorded successfully. Your may now close your browser window.  Thank you very much, ' . $contact->contact_first_name);
    }
}
?>
Пример #7
0
require_once W2P_BASE_DIR . '/includes/db_adodb.php';
require_once W2P_BASE_DIR . '/classes/query.class.php';
require_once W2P_BASE_DIR . '/classes/ui.class.php';
$AppUI = new CAppUI();
require_once W2P_BASE_DIR . '/classes/date.class.php';
require_once W2P_BASE_DIR . '/modules/contacts/contacts.class.php';
require_once W2P_BASE_DIR . '/classes/CustomFields.class.php';
$msg = '';
$updatekey = w2PgetParam($_POST, 'updatekey', 0);
$contactkey = CContact::getContactByUpdatekey($updatekey);
$contact = new CContact();
$q = new DBQuery();
$contact_id = $contactkey ? $contactkey : 0;
// check permissions for this record
if (!$contact_id) {
    echo $AppUI->_('You are not authorized to use this page. If you should be authorized please contact Bruce Bodger to give you another valid link, thank you.');
    exit;
}
if (!$contact->bind($_POST)) {
    $AppUI->setMsg($contact->getError(), UI_MSG_ERROR);
    $AppUI->redirect();
}
// prepare (and translate) the module name ready for the suffix
$AppUI->setMsg('Contact');
$isNotNew = $_POST['contact_id'];
if ($msg = $contact->store($AppUI)) {
    $AppUI->setMsg($msg, UI_MSG_ERROR);
    $msg = $AppUI->_('There was an error recording your contact data, please contact the system administrator. Thank you very much.');
} else {
    $custom_fields = new CustomFields('contacts', 'addedit', $contact->contact_id, 'edit', 1);
    $custom_fields->bind($_POST);
Пример #8
0
require_once 'base.php';
require_once W2P_BASE_DIR . '/includes/config.php';
if (!isset($GLOBALS['OS_WIN'])) {
    $GLOBALS['OS_WIN'] = stristr(PHP_OS, "WIN") !== false;
}
// tweak for pathname consistence on windows machines
require_once W2P_BASE_DIR . '/includes/main_functions.php';
require_once W2P_BASE_DIR . '/includes/db_adodb.php';
$AppUI = new CAppUI();
$updatekey = w2PgetParam($_GET, 'updatekey', 0);
$contact_id = CContact::getContactByUpdatekey($updatekey);
$company_id = intval(w2PgetParam($_REQUEST, 'company_id', 0));
$company_name = w2PgetParam($_REQUEST, 'company_name', null);
// check permissions for this record
if (!$contact_id) {
    echo $AppUI->_('You are not authorized to use this page. If you should be authorized please contact') . ' ' . $w2Pconfig['company_name'] . ' ' . $AppUI->_('to give you another valid link, thank you.');
    exit;
}
// load the record data
$msg = '';
$row = new CContact();
if (!$row->load($contact_id) && $contact_id > 0) {
    $AppUI->setMsg('Contact');
    $AppUI->setMsg('invalidID', UI_MSG_ERROR, true);
    $AppUI->redirect();
} else {
    if ($row->contact_private && $row->contact_owner != $AppUI->user_id && $row->contact_owner && $contact_id != 0) {
        // check only owner can edit
        $AppUI->redirect('m=public&a=access_denied');
    }
}