public function getContactUpdateNotify(w2p_Core_CAppUI $AppUI = null, CContact $contact)
 {
     $this->_AppUI = !is_null($AppUI) ? $AppUI : $this->_AppUI;
     $company = new CCompany();
     $company->load($contact->contact_company);
     $contact->company_name = $company->company_name;
     $contact->user_display_name = $this->_AppUI->user_display_name;
     $body = "Dear contact_title contact_display_name,";
     $body .= "\n\nIt was very nice to visit you";
     $body .= $contact->contact_company ? " and company_name." : ".";
     $body .= " Thank you for all the time that you spent with me.";
     $body .= "\n\nI have entered the data from your business card into my contact database so that we may keep in touch.";
     $body .= " We have implemented a system which allows you to view the information that I've recorded and give you the opportunity to correct it or add information as you see fit. Please click on this link to view what I've recorded:";
     $body .= "\n\n" . W2P_BASE_URL . "/updatecontact.php?updatekey=contact_updatekey";
     $body .= "\n\nI assure you that the information will be held in strict confidence and will not be available to anyone other than me. I realize that you may not feel comfortable filling out the entire form so please supply only what you're comfortable with.";
     $body .= "\n\nThank you. I look forward to seeing you again, soon.";
     $body .= "\n\nBest Regards,\nuser_display_name";
     return $this->templater->render($body, $contact);
 }
Esempio n. 2
0
 public function getCompanyDetails()
 {
     $company = new CCompany();
     $company->load((int) $this->contact_company);
     return array('company_id' => $company->company_id, 'company_name' => $company->company_name);
 }
Esempio n. 3
0
<th><?php 
echo $AppUI->_('Status');
?>
</th>
</tr>
<?php 
//while ($line = mysql_fetch_array($res, MYSQL_ASSOC)) {
$s = '';
foreach ($st_projects_arr as $project) {
    $line = $project[0];
    $level = $project[1];
    if ($line['project_id']) {
        $s_project = new CProject();
        $s_project->load($line['project_id']);
        $s_company = new CCompany();
        $s_company->load($s_project->project_company);
        $start_date = intval($s_project->project_start_date) ? new CDate($s_project->project_start_date) : null;
        $end_date = intval($s_project->project_end_date) ? new CDate($s_project->project_end_date) : null;
        $actual_end_date = intval($s_project->project_actual_end_date) ? new CDate($s_project->project_actual_end_date) : null;
        $style = $actual_end_date > $end_date && !empty($end_date) ? 'style="color:red; font-weight:bold"' : '';
        $x++;
        $row_class = $x % 2 ? 'style="background:#fff;"' : 'style="background:#f0f0f0;"';
        $row_classr = $x % 2 ? 'style="background:#fff;text-align:right;"' : 'style="background:#f0f0f0;text-align:right;"';
        $s .= '<tr><td ' . $row_class . ' align="center"><a href="./index.php?m=projects&a=addedit&project_id=' . $line['project_id'] . '"><img src="' . w2PfindImage('icons/' . ($project_id == $line['project_id'] ? 'pin' : 'pencil') . '.gif') . '" border=0 /></b></a></td>';
        $s .= '<td ' . $row_classr . ' nowrap="nowrap">' . $line['project_id'] . '</td>';
        if ($level) {
            $sd = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $level - 1) . w2PshowImage('corner-dots.gif', 16, 12) . '&nbsp;' . '<a href="./index.php?m=projects&a=view&project_id=' . $line['project_id'] . '">' . $line['project_name'] . '</a>';
        } else {
            $sd = '<a href="./index.php?m=projects&a=view&project_id=' . $line['project_id'] . '">' . $line['project_name'] . '</a>';
        }
        $s .= '<td ' . $row_class . '>' . $sd . '</td>';
Esempio n. 4
0
    $project->loadFull($AppUI, $project_id);
}
if (!$project && $project_id > 0) {
    $AppUI->setMsg('Project');
    $AppUI->setMsg('invalidID', UI_MSG_ERROR, true);
    $AppUI->redirect();
} elseif (count($companies) < 2 && $project_id == 0) {
    $AppUI->setMsg('noCompanies', UI_MSG_ERROR, true);
    $AppUI->redirect();
}
if ($project_id == 0 && $company_id > 0) {
    $project->project_company = $company_id;
}
// add in the existing company if for some reason it is dis-allowed
if ($project_id && !array_key_exists($project->project_company, $companies)) {
    $companies[$project->project_company] = $company->load($project->project_company)->company_name;
}
// get critical tasks (criteria: task_end_date)
$criticalTasks = $project_id > 0 ? $project->getCriticalTasks() : null;
// get ProjectPriority from sysvals
$projectPriority = w2PgetSysVal('ProjectPriority');
// format dates
$df = $AppUI->getPref('SHDATEFORMAT');
$start_date = new w2p_Utilities_Date($project->project_start_date);
$end_date = intval($project->project_end_date) ? new w2p_Utilities_Date($project->project_end_date) : null;
$actual_end_date = intval($criticalTasks[0]['task_end_date']) ? new w2p_Utilities_Date($criticalTasks[0]['task_end_date']) : null;
$style = $actual_end_date > $end_date && !empty($end_date) ? 'style="color:red; font-weight:bold"' : '';
// setup the title block
$ttl = $project_id > 0 ? 'Edit Project' : 'New Project';
$titleBlock = new CTitleBlock($ttl, 'applet3-48.png', $m, $m . '.' . $a);
$titleBlock->addCrumb('?m=projects', 'projects list');
Esempio n. 5
0
</td>
	</tr>
	</table>
<?php 
    if ($log_pdf) {
        // make the PDF file
        if ($project_id) {
            $project = new CProject();
            $project->load($project_id);
            $pname = 'Project: ' . $project->project_name;
        } else {
            $pname = 'All Companies and All Projects';
        }
        if ($company_id) {
            $company = new CCompany();
            $company->load($company_id);
            $cname = 'Company: ' . $company->company_name;
        } else {
            $cname = 'All Companies and All Projects';
        }
        if ($log_userfilter) {
            $q = new w2p_Database_Query();
            $q->addTable('contacts');
            $q->addQuery('contact_display_name');
            $q->addJoin('users', '', 'user_contact = contact_id', 'inner');
            $q->addWhere('user_id =' . (int) $log_userfilter);
            $uname = 'User: '******'All Users';
        }
        $output = new w2p_Output_PDFRenderer();
function getTaskTooltip($task_id)
{
    global $AppUI;
    if (!$task_id) {
        return '';
    }
    $df = $AppUI->getPref('SHDATEFORMAT');
    $tf = $AppUI->getPref('TIMEFORMAT');
    $task = new CTask();
    // load the record data
    $task->load($task_id);
    // load the event types
    $types = w2PgetSysVal('TaskType');
    $assignees = $task->assignees($task_id);
    $assigned = array();
    foreach ($assignees as $user) {
        $assigned[] = $user['contact_name'] . ' ' . $user['perc_assignment'] . '%';
    }
    $start_date = (int) $task->task_start_date ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($task->task_start_date, '%Y-%m-%d %T')) : null;
    $end_date = (int) $task->task_end_date ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($task->task_end_date, '%Y-%m-%d %T')) : null;
    // load the record data
    $project = new CProject();
    $project->load($task->task_project);
    $task_project = $project->project_name;
    $company = new CCompany();
    $company->load($project->project_company);
    $task_company = $company->company_name;
    $tt = '<table class="tool-tip">';
    $tt .= '<tr>';
    $tt .= '	<td valign="top" width="40%">';
    $tt .= '		<strong>' . $AppUI->_('Details') . '</strong>';
    $tt .= '		<table cellspacing="3" cellpadding="2" width="100%">';
    $tt .= '		<tr>';
    $tt .= '			<td class="tip-label">' . $AppUI->_('Company') . '</td>';
    $tt .= '			<td>' . $task_company . '</td>';
    $tt .= '		</tr>';
    $tt .= '		<tr>';
    $tt .= '			<td class="tip-label">' . $AppUI->_('Project') . '</td>';
    $tt .= '			<td>' . $task_project . '</td>';
    $tt .= '		</tr>';
    $tt .= '		<tr>';
    $tt .= '			<td class="tip-label">' . $AppUI->_('Type') . '</td>';
    $tt .= '			<td>' . $AppUI->_($types[$task->task_type]) . '</td>';
    $tt .= '		</tr>	';
    $tt .= '		<tr>';
    $tt .= '			<td class="tip-label">' . $AppUI->_('Progress') . '</td>';
    $tt .= '			<td>' . sprintf("%.1f%%", $task->task_percent_complete) . '</td>';
    $tt .= '		</tr>	';
    $tt .= '		<tr>';
    $tt .= '			<td class="tip-label">' . $AppUI->_('Starts') . '</td>';
    $tt .= '			<td>' . ($start_date ? $start_date->format($df . ' ' . $tf) : '-') . '</td>';
    $tt .= '		</tr>';
    $tt .= '		<tr>';
    $tt .= '			<td class="tip-label">' . $AppUI->_('Ends') . '</td>';
    $tt .= '			<td>' . ($end_date ? $end_date->format($df . ' ' . $tf) : '-') . '</td>';
    $tt .= '		</tr>';
    $tt .= '		<tr>';
    $tt .= '			<td class="tip-label">' . $AppUI->_('Assignees') . '</td>';
    $tt .= '			<td>';
    $tt .= implode('<br />', $assigned);
    $tt .= '		</tr>';
    $tt .= '		</table>';
    $tt .= '	</td>';
    $tt .= '	<td width="60%" valign="top">';
    $tt .= '		<strong>' . $AppUI->_('Description') . '</strong>';
    $tt .= '		<table cellspacing="0" cellpadding="2" border="0" width="100%">';
    $tt .= '		<tr>';
    $tt .= '			<td class="tip-label description">';
    $tt .= '				' . $task->task_description;
    $tt .= '			</td>';
    $tt .= '		</tr>';
    $tt .= '		</table>';
    $tt .= '	</td>';
    $tt .= '</tr>';
    $tt .= '</table>';
    return $tt;
}
Esempio n. 7
0
 /**
  * @deprecated
  */
 public function getCompanyName()
 {
     trigger_error("getCompanyName has been deprecated and will be removed in v4.0. Please use getCompanyDetails() instead.", E_USER_NOTICE);
     $company = new CCompany();
     $company->overrideDatabase($this->_query);
     $company->load((int) $this->contact_company);
     return $company->company_name;
 }
Esempio n. 8
0
 /**
  * Tests the delete of a company
  */
 public function testDelete()
 {
     $this->obj->bind($this->post_data);
     $result = $this->obj->store();
     $this->assertTrue($result);
     $original_id = $this->obj->company_id;
     $result = $this->obj->delete();
     $item = new CCompany();
     $item->overrideDatabase($this->mockDB);
     $this->mockDB->stageHash(array('company_name' => '', 'company_owner' => ''));
     $item->load($original_id);
     $this->assertEquals('', $item->company_name);
     $this->assertEquals('', $item->company_owner);
 }
Esempio n. 9
0
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
$company_id = (int) w2PgetParam($_GET, 'company_id', 0);
$tab = $AppUI->processIntState('CompVwTab', $_GET, 'tab', 0);
$company = new CCompany();
if (!$company->load($company_id)) {
    $AppUI->redirect(ACCESS_DENIED);
}
$canEdit = $company->canEdit();
$canDelete = $company->canDelete();
$deletable = $canDelete;
//TODO: this should be removed once the $deletable variable is removed
$contact = new CContact();
$canCreateContacts = $contact->canCreate();
// setup the title block
$titleBlock = new w2p_Theme_TitleBlock('View Company', 'icon.png', $m);
$titleBlock->addCrumb('?m=' . $m, $m . ' list');
if ($canCreateContacts) {
    $titleBlock->addButton('New contact', '?m=contacts&a=addedit&company_id=' . $company_id);
}
if ($canEdit) {
    if ($AppUI->isActiveModule('departments')) {
        $titleBlock->addButton('New department', '?m=departments&a=addedit&company_id=' . $company_id);
    }
    $titleBlock->addButton('New project', '?m=projects&a=addedit&company_id=' . $company_id);
    $titleBlock->addCrumb('?m=companies&a=addedit&company_id=' . $company_id, 'edit this company');
    if ($canDelete && $deletable) {
        $titleBlock->addCrumbDelete('delete company', $deletable, $msg);