public function getHTML($mode)
 {
     $html = '<label>' . $this->field_description . ':</label>';
     switch ($mode) {
         case 'edit':
             $html .= '<input type="text" class="text" name="' . $this->fieldName() . '" value="' . $this->charValue() . '" ' . $this->fieldExtraTags() . ' />';
             break;
         case 'view':
             $html .= w2p_email($this->charValue());
             break;
     }
     return $html;
 }
Пример #2
0
 public function addField($fieldName, $fieldValue)
 {
     if ('' == $fieldValue) {
         return '-';
     }
     $pieces = explode('_', $fieldName);
     $suffix = end($pieces);
     switch ($suffix) {
         case 'datetime':
             $myDate = intval($fieldValue) ? new w2p_Utilities_Date($this->AppUI->formatTZAwareTime($fieldValue, '%Y-%m-%d %T')) : null;
             $output = $myDate ? $myDate->format($this->dtf) : '-';
             break;
         case 'email':
             $output = w2p_email($fieldValue);
             break;
         case 'url':
             $value = str_replace(array('"', '"', '<', '>'), '', $fieldValue);
             $output = w2p_url($value);
             break;
         case 'owner':
             if (!$fieldValue) {
                 return '-';
             }
             $obj = new CContact();
             $obj->findContactByUserid($fieldValue);
             $link = '?m=users&a=view&user_id=' . $fieldValue;
             $output = '<a href="' . $link . '">' . $obj->contact_display_name . '</a>';
             break;
         case 'percent':
             $output = round($fieldValue) . '%';
             break;
         case 'description':
             $output = w2p_textarea($fieldValue);
             break;
         case 'company':
         case 'department':
         case 'project':
             $class = 'C' . ucfirst($suffix);
             $obj = new $class();
             $obj->load($fieldValue);
             $link = '?m=' . w2p_pluralize($suffix) . '&a=view&' . $suffix . '_id=' . $fieldValue;
             $output = '<a href="' . $link . '">' . $obj->{"{$suffix}" . '_name'} . '</a>';
             break;
         default:
             $output = htmlspecialchars($fieldValue, ENT_QUOTES);
     }
     return $output;
 }
Пример #3
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;
 }
Пример #4
0
		<th><?php 
    echo $AppUI->_('Department');
    ?>
</th>
	</tr>
	<?php 
    $contact = new CContact();
    foreach ($contacts as $contact_id => $contact_data) {
        $contact->contact_id = $contact_id;
        echo '<tr><td class="hilite">';
        echo '<a href="./index.php?m=contacts&a=view&contact_id=' . $contact_data['contact_id'] . '">';
        echo $contact_data['contact_first_name'] . ' ' . $contact_data['contact_last_name'];
        echo '</a>';
        echo '</td>';
        echo '<td class="hilite">' . $contact_data['contact_job'] . '</td>';
        echo '<td class="hilite">' . w2p_email($contact_data['contact_email']) . '</td>';
        echo '<td class="hilite">' . $contact_data['contact_phone'] . '</td>';
        echo '<td class="hilite">' . $contact_data['dept_name'] . '</td>';
        echo '</tr>';
    }
} else {
    ?>
<tr><td colspan="5"><?php 
    echo $AppUI->_('No data available') . '<br />' . $AppUI->getMsg();
    ?>
</td></tr><?php 
}
?>

	<tr>
		<td colspan="5" align="right" valign="top" style="background-color:#ffffff">
Пример #5
0
            echo w2PtoolTip('info', 'Update sucessfully done on: ' . $last_ask->format($df) . '') . '<img src="' . w2PfindImage('log-notice.gif') . '" style="float: right;">' . w2PendTip();
        }
        ?>
                                                    </span>
												</th>
											</table>
										</td>
									</tr>
									<tr>
										<?php 
        reset($showfields);
        $s = '';
        while (list($key, $val) = each($showfields)) {
            if (mb_strlen($carr[$z][$x][$key]) > 0) {
                if ($val == 'contact_email') {
                    $s .= '<td class="hilite" colspan="2">' . w2p_email($carr[$z][$x][$key]) . '</td></tr>';
                } elseif ($val == 'contact_company' && is_numeric($carr[$z][$x][$key])) {
                    //Don't do a thing
                } elseif ($val == 'company_name') {
                    $s .= '<tr><td width="35%"><strong>' . $AppUI->_('Company') . ':</strong></td><td class="hilite" width="65%">' . $carr[$z][$x][$key] . '</td></tr>';
                } elseif ($val == 'contact_job') {
                    $s .= '<tr><td width="35%"><strong>' . $AppUI->_('Job Title') . ':</strong></td><td class="hilite" width="65%">' . $carr[$z][$x][$key] . '</td></tr>';
                } elseif ($val == 'dept_name') {
                    $s .= '<tr><td width="35%"><strong>' . $AppUI->_('Department') . ':</strong></td><td class="hilite" width="65%">' . $carr[$z][$x][$key] . '</td></tr>';
                } elseif ($val == 'contact_country' && $carr[$z][$x][$key]) {
                    $s .= '<tr><td class="hilite" colspan="2">' . ($countries[$carr[$z][$x][$key]] ? $countries[$carr[$z][$x][$key]] : $carr[$z][$x][$key]) . '<br /></td></tr>';
                } elseif ($val != 'contact_country') {
                    $s .= '<tr><td class="hilite" colspan="2">' . $carr[$z][$x][$key] . '<br /></td></tr>';
                } elseif ($val == 'contact_phone') {
                    $s .= '<tr><td width="35%"><strong>' . $AppUI->_('Work Phone') . ':</strong></td><td class="hilite" width="65%">' . $carr[$z][$x][$key] . '</td></tr>';
                }
Пример #6
0
echo $AppUI->_('Owner');
?>
:</td>
					<td class="hilite" width="100%"><?php 
echo $company->contact_first_name . ' ' . $company->contact_last_name;
?>
</td>
				</tr>
				<tr>
					<td align="right" nowrap="nowrap"><?php 
echo $AppUI->_('Email');
?>
:</td>
					<td class="hilite" width="100%">
            <?php 
echo w2p_email($company->company_email);
?>
          </td>
				</tr>
				<tr>
					<td align="right" nowrap="nowrap"><?php 
echo $AppUI->_('Phone');
?>
:</td>
					<td class="hilite"><?php 
echo $company->company_phone1;
?>
</td>
				</tr>
				<tr>
					<td align="right" nowrap="nowrap"><?php 
 /**
  * Tests the proper creation of an email link
  */
 public function test_w2p_email()
 {
     $target = '<a href="mailto:test@test.com">test@test.com</a>';
     $linkText = w2p_email('*****@*****.**');
     $this->assertEquals($target, $linkText);
     $target = '';
     $linkText = w2p_email('');
     $this->assertEquals($target, $linkText);
     $target = '<a href="mailto:test@test.com">web2project</a>';
     $linkText = w2p_email('*****@*****.**', 'web2project');
     $this->assertEquals($target, $linkText);
 }
Пример #8
0
					<td align="right" nowrap="nowrap"><?php 
echo $AppUI->_('Type');
?>
:</td>
					<td class="hilite" width="100%"><?php 
echo $types[$department->dept_type];
?>
</td>
				</tr>
				<tr>
					<td align="right" nowrap="nowrap"><?php 
echo $AppUI->_('Email');
?>
:</td>
					<td class="hilite" width="100%"><?php 
echo w2p_email($department->dept_email);
?>
</td>
				</tr>
				<tr>
					<td align="right" nowrap="nowrap"><?php 
echo $AppUI->_('Phone');
?>
:</td>
					<td class="hilite" width="100%"><?php 
echo $department->dept_phone;
?>
</td>
				</tr>
				<tr>
					<td align="right" nowrap="nowrap"><?php 
Пример #9
0
            <table cellspacing="1" cellpadding="2" border="0" width="100%">
                <tr>
                    <td colspan="3"><strong><?php 
echo $AppUI->_('Assigned Users');
?>
</strong></td>
                </tr>
                <tr>
                    <td colspan="3">
                        <?php 
$s = '';
$s = count($users) == 0 ? '<tr><td bgcolor="#ffffff">' . $AppUI->_('none') . '</td></tr>' : '';
foreach ($users as $row) {
    $s .= '<tr>';
    $s .= '<td class="hilite" width=80%>';
    $s .= w2p_email($row['user_email'], $row['contact_display_name']);
    $s .= '</td>';
    $s .= $htmlHelper->createCell('perc_assignment', $row['perc_assignment']);
    $s .= '</tr>';
}
echo '<table width="100%" cellspacing="1" bgcolor="black">' . $s . '</table>';
?>
                    </td>
                </tr>
                <tr>
                    <td colspan="3"><strong><?php 
echo $AppUI->_('Dependencies');
?>
</strong></td>
                </tr>
                <tr>
Пример #10
0
                <td class="hilite" width="100%">
                    <?php 
    $bday = new w2p_Utilities_Date($user->contact_birthday);
    $df = $AppUI->getPref('SHDATEFORMAT');
    echo $bday->format($df);
    ?>
                </td>
            </tr>
            <tr>
                <td align="right" nowrap="nowrap"><?php 
    echo $AppUI->_('Email');
    ?>
:</td>
                <td class="hilite" width="100%">
                    <?php 
    echo w2p_email($user->contact_email);
    ?>
                </td>
            </tr>
            <?php 
    foreach ($methods as $method => $value) {
        ?>
                <tr>
                    <td align="right" width="100" nowrap="nowrap"><?php 
        echo $AppUI->_($methodLabels[$method]);
        ?>
:</td>
                    <td class="hilite" width="100%"><?php 
        echo $value;
        ?>
</td>
Пример #11
0
 /**
  * createColumn is handy because it can take any input $fieldName and use
  *   its suffix to determine how the field should be displayed.
  *
  * This allows us to treat project_description, task_description,
  *   company_description, or even some_other_crazy_wacky_description in
  *   exactly the same way without additional lines of code or configuration.
  *   If you want to do your own, feel free... but this is probably easier.
  * 
  * Examples: _budget, _date, _name, _owner
  * 
  * This may not work for things like company_type or project_type which are
  *   actually just references to look up tables, ... but should work on
  *   fields like project_company, dept_company because we still have a 
  *   common suffix.
  *
  * @note I'm kind of annoyed about the complexity and sheer number of
  *   paths of this method but overall I think it's laid out reasonably
  *   well. I think the more important part is that I've been able to
  *   encapsulate it all here instead of spreading it all over the modules
  *   and views.
  */
 public function createCell($fieldName, $value, $custom = array())
 {
     $additional = '';
     if ('' == $value) {
         return '<td>-</td>';
     }
     $pieces = explode('_', $fieldName);
     $prefix = $pieces[0];
     $suffix = '_' . end($pieces);
     if ($fieldName == 'project_actual_end_date') {
         $suffix = '_actual';
     }
     switch ($suffix) {
         //BEGIN: object-based linkings
         /*
          * TODO: The following cases are likely to change once we have an approach to 
          *   handle module-level objects and their proper mapping/linkings.
         */
         case '_company':
         case '_contact':
         case '_task':
             $module = substr($suffix, 1);
             $class = 'C' . ucfirst($module);
             $obj = new $class();
             $obj->load($value);
             $link = '?m=' . w2p_pluralize($module) . '&a=view&' . $module . '_id=' . $value;
             $cell = '<a href="' . $link . '">' . $obj->{"{$module}" . '_name'} . '</a>';
             $suffix .= ' _name';
             break;
         case '_department':
             $module = substr($suffix, 1);
             $class = 'C' . ucfirst($module);
             $obj = new $class();
             $obj->load($value);
             /**
              * This is a branch separate from _company, _contact, etc above because although the module is called
              *   departments, the fields are dept_id and dept_name. :(
              *                                                              ~ caseydk, Dec 11 2013
              */
             $link = '?m=' . w2p_pluralize($module) . '&a=view&dept_id=' . $value;
             $cell = '<a href="' . $link . '">' . $obj->dept_name . '</a>';
             $suffix .= ' _name';
             break;
         case '_folder':
             $obj = new CFile_Folder();
             $obj->load($value);
             $foldername = $value ? $obj->file_folder_name : 'Root';
             $image = '<img src="' . w2PfindImage('folder5_small.png', 'files') . '" />';
             $link = '?m=files&tab=4&folder=' . (int) $value;
             $cell = '<a href="' . $link . '">' . $image . ' ' . $foldername . '</a>';
             $suffix .= ' _name';
             break;
         case '_user':
         case '_username':
             $obj = new CContact();
             $obj->findContactByUserid($this->tableRowData['user_id']);
             $link = '?m=users&a=view&user_id=' . $this->tableRowData['user_id'];
             $cell = '<a href="' . $link . '">' . $obj->user_username . '</a>';
             break;
             //END: object-based linkings
             /*
              * TODO: These two prefix adjustments are an ugly hack because our departments 
              *   table doesn't follow the same convention as every other table we have. 
              *   This needs to be fixed in v4.0 - caseydk 13 Feb 2012
              *
              * TODO: And unfortunately, the forums module is screwy using 'viewer' instead 
              *   of our standard 'view' for the page. ~ caseydk 16 Feb 2012
             */
         //END: object-based linkings
         /*
          * TODO: These two prefix adjustments are an ugly hack because our departments 
          *   table doesn't follow the same convention as every other table we have. 
          *   This needs to be fixed in v4.0 - caseydk 13 Feb 2012
          *
          * TODO: And unfortunately, the forums module is screwy using 'viewer' instead 
          *   of our standard 'view' for the page. ~ caseydk 16 Feb 2012
         */
         case '_name':
             $prefix = $prefix == 'project_short' ? 'project' : $prefix;
             $prefix = $prefix == 'dept' ? 'department' : $prefix;
             $page = $prefix == 'forum' || $prefix == 'message' ? 'viewer' : 'view';
             $link = '?m=' . w2p_pluralize($prefix) . '&a=' . $page . '&';
             $link = $prefix == 'message' ? '?m=forums&a=' . $page . '&' : $link;
             $prefix = $prefix == 'department' ? 'dept' : $prefix;
             $link .= $prefix . '_id=' . $this->tableRowData[$prefix . '_id'];
             $link .= $prefix == 'task_log' ? '&tab=1&task_id=' . $this->tableRowData['task_id'] : '';
             $icon = $fieldName == 'file_name' ? '<img src="' . w2PfindImage(getIcon($this->tableRowData['file_type']), 'files') . '" />&nbsp;' : '';
             $cell = '<a href="' . $link . '">' . $icon . $value . '</a>';
             //TODO: task_logs are another oddball..
             $cell = $prefix == 'task_log' ? str_replace('task_logs', 'tasks', $cell) : $cell;
             break;
         case '_author':
         case '_creator':
         case '_owner':
         case '_updator':
             if ((int) $value) {
                 $obj = new CContact();
                 $obj->findContactByUserid($value);
                 $suffix .= ' nowrap';
                 $link = '?m=users&a=view&user_id=' . $value;
                 $cell = '<a href="' . $link . '">' . $obj->contact_display_name . '</a>';
             } else {
                 $cell = $value;
             }
             break;
             // The above are all contact/user display names, the below are numbers.
         // The above are all contact/user display names, the below are numbers.
         case '_count':
         case '_hours':
             $cell = $value;
             break;
         case '_duration':
             $durnTypes = w2PgetSysVal('TaskDurationType');
             $cell = $value . ' ' . $this->AppUI->_($durnTypes[$this->tableRowData['task_duration_type']]);
             break;
         case '_size':
             $cell = file_size($value);
             break;
         case '_budget':
             $cell = w2PgetConfig('currency_symbol');
             $cell .= formatCurrency($value, $this->AppUI->getPref('CURRENCYFORM'));
             break;
         case '_url':
             $value = str_replace(array('"', '"', '<', '>'), '', $value);
             $cell = w2p_url($value);
             break;
         case '_email':
             $cell = w2p_email($value);
             break;
         case '_birthday':
         case '_date':
             $myDate = intval($value) ? new w2p_Utilities_Date($value) : null;
             $cell = $myDate ? $myDate->format($this->df) : '-';
             break;
         case '_actual':
             $end_date = intval($this->tableRowData['project_end_date']) ? new w2p_Utilities_Date($this->tableRowData['project_end_date']) : null;
             $actual_end_date = intval($this->tableRowData['project_actual_end_date']) ? new w2p_Utilities_Date($this->tableRowData['project_actual_end_date']) : null;
             $style = $actual_end_date < $end_date && !empty($end_date) ? 'style="color:red; font-weight:bold"' : '';
             if ($actual_end_date) {
                 $cell = '<a href="?m=tasks&a=view&task_id=' . $this->tableRowData['project_last_task'] . '" ' . $style . '>' . $actual_end_date->format($this->df) . '</a>';
             } else {
                 $cell = '-';
             }
             break;
         case '_created':
         case '_datetime':
         case '_update':
         case '_updated':
             $myDate = intval($value) ? new w2p_Utilities_Date($this->AppUI->formatTZAwareTime($value, '%Y-%m-%d %T')) : null;
             $cell = $myDate ? $myDate->format($this->dtf) : '-';
             break;
         case '_description':
             $cell = w2p_textarea($value);
             break;
         case '_priority':
             $mod = $value > 0 ? '+' : '-';
             $image = '<img src="' . w2PfindImage('icons/priority' . $mod . abs($value) . '.gif') . '" width="13" height="16" alt="">';
             $cell = $value != 0 ? $image : '';
             break;
         case '_complete':
         case '_assignment':
         case '_allocated':
         case '_allocation':
             $cell = round($value) . '%';
             break;
         case '_password':
             $cell = '(' . $this->AppUI->_('hidden') . ')';
             break;
         case '_version':
             $value = (int) (100 * $value);
             $cell = number_format($value / 100, 2);
             break;
         case '_identifier':
             $additional = 'style="background-color:#' . $value . '; color:' . bestColor($value) . '" ';
             $cell = $this->tableRowData['project_percent_complete'] . '%';
             break;
         case '_project':
             $module = substr($suffix, 1);
             $class = 'C' . ucfirst($module);
             $obj = new $class();
             $obj->load($value);
             $color = $obj->project_color_identifier;
             $link = '?m=' . w2p_pluralize($module) . '&a=view&' . $module . '_id=' . $value;
             $cell = '<span style="background-color:#' . $color . '; padding: 3px"><a href="' . $link . '" style="color:' . bestColor($color) . '">' . $obj->{"{$module}" . '_name'} . '</a></span>';
             $suffix .= ' _name';
             break;
         case '_assignees':
             $cell = $value;
             break;
         case '_problem':
             if ($value) {
                 $cell = '<a href="?m=tasks&a=index&f=all&project_id=' . $this->tableRowData['project_id'] . '">';
                 $cell .= w2PshowImage('icons/dialog-warning5.png', 16, 16, 'Problem', 'Problem');
                 $cell .= '</a>';
             } else {
                 $cell = '-';
             }
             break;
         default:
             $value = isset($custom[$fieldName]) ? $custom[$fieldName][$value] : $value;
             $cell = htmlspecialchars($value, ENT_QUOTES);
     }
     $begin = '<td ' . $additional . 'class="' . $suffix . '">';
     $end = '</td>';
     return $begin . $cell . $end;
 }
Пример #12
0
echo $AppUI->_('Name');
?>
</th><th><?php 
echo $AppUI->_('Email');
?>
</th><th><?php 
echo $AppUI->_('Telephone');
?>
</th></tr>
<?php 
$contacts = CDepartment::getContactList($AppUI, $dept_id);
$contact = new CContact();
foreach ($contacts as $contact_id => $contact_data) {
    $contact->contact_id = $contact_id;
    echo '<tr><td><a href="./index.php?m=contacts&a=view&contact_id=' . $contact_data['contact_id'] . '">' . $contact_data['contact_first_name'] . ' ' . $contact_data['contact_last_name'] . '</a></td>';
    echo '<td>' . w2p_email($contact_data['contact_email']) . '</td>';
    echo '<td>' . $contact_data['contact_phone'] . '</td></tr>';
}
?>
	<tr>
		<td colspan="3" align="right" valign="top" style="background-color:#ffffff">
			<input type="button" class="button" value="<?php 
echo $AppUI->_('new contact');
?>
" onclick="javascript:window.location='./index.php?m=contacts&a=addedit&company_id=<?php 
echo $company_id;
?>
&company_name=<?php 
echo $dept['company_name'];
?>
&dept_id=<?php 
Пример #13
0
					<td align="right"><?php 
echo $AppUI->_('Phone');
?>
:</td>
					<td nowrap="nowrap" class="hilite" width="100%"><?php 
echo $contact->contact_phone;
?>
</td>
				</tr>
				<tr>
					<td align="right"><?php 
echo $AppUI->_('Email');
?>
:</td>
					<td nowrap="nowrap" class="hilite" width="100%"><?php 
echo w2p_email($contact->contact_email);
?>
</td>
				</tr>
                <?php 
foreach ($methods as $method => $value) {
    ?>
                    <tr>
                        <td align="right" width="100" nowrap="nowrap"><?php 
    echo $AppUI->_($methodLabels[$method]);
    ?>
:</td>
                        <td class="hilite" width="100%"><?php 
    echo $value;
    ?>
</td>
Пример #14
0
    </table>
</td>

<td width="50%" valign="top" class="view-column">
    <strong><?php 
echo $AppUI->_('Assigned Users');
?>
</strong>
    <table cellspacing="1" cellpadding="2" border="0" width="100%" class="well">
        <?php 
$s = count($users) == 0 ? '<tr><td bgcolor="#ffffff">' . $AppUI->_('none') . '</td></tr>' : '';
foreach ($users as $row) {
    $display = '' == $row['contact_display_name'] ? $row['user_email'] : $row['contact_display_name'];
    $s .= '<tr>';
    $s .= '<td width=80%>';
    $s .= w2p_email($row['user_email'], $display);
    $s .= '</td>';
    $s .= $htmlHelper->createCell('perc_assignment', $row['perc_assignment']);
    $s .= '</tr>';
}
echo $s;
?>
    </table>
    <strong><?php 
echo $AppUI->_('Dependencies');
?>
</strong>
    <table width="100%" cellspacing="1" cellpadding="2" class="tbl list well">
        <?php 
$taskDep = $obj->getDependencyList($task_id);
$s = count($taskDep) == 0 ? '<tr><td>' . $AppUI->_('none') . '</td></tr>' : '<tr><th>' . $AppUI->_('Task') . '</th>' . '<th>' . $AppUI->_('Work') . '</th>' . '<th>' . $AppUI->_('Start Date') . '</th>' . '<th>' . $AppUI->_('End Date') . '</th></tr>';