public static function renderColumn(CAppUI $AppUI, $fieldName, $row) { switch ($fieldName) { case 'project_creator': case 'project_owner': $s .= '<td nowrap="nowrap">'; $s .= w2PgetUsernameFromID($row[$fieldName]); $s .= '</td>'; break; case 'project_target_budget': case 'project_actual_budget': $s .= '<td>'; $s .= $w2Pconfig['currency_symbol']; $s .= formatCurrency($row[$fieldName], $AppUI->getPref('CURRENCYFORM')); $s .= '</td>'; break; case 'project_url': case 'project_demo_url': $s .= '<td>'; $s .= w2p_url($row[$fieldName]); $s .= '</td>'; break; case 'project_start_date': case 'project_end_date': $df = $AppUI->getPref('SHDATEFORMAT'); $myDate = intval($row[$fieldName]) ? new w2p_Utilities_Date($row[$fieldName]) : null; $s .= '<td nowrap="nowrap" class="center">' . ($myDate ? $myDate->format($df) : '-') . '</td>'; break; default: $s .= '<td nowrap="nowrap" class="center">'; $s .= htmlspecialchars($row[$fieldName], ENT_QUOTES); $s .= '</td>'; } return $s; }
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; }
<img align="right" border="0" src="<?php echo w2PfindImage('googlemaps.gif'); ?> " width="55" height="22" alt="Find It on Google" /></a> <?php echo $company->company_address1 . ($company->company_address2 ? '<br />' . $company->company_address2 : '') . ($company->company_city ? '<br />' . $company->company_city : '') . ($company->company_state ? '<br />' . $company->company_state : '') . ($company->company_zip ? '<br />' . $company->company_zip : '') . ($company->company_country ? '<br />' . $countries[$company->company_country] : ''); ?> </td> </tr> <tr> <td align="right" nowrap="nowrap"><?php echo $AppUI->_('URL'); ?> :</td> <td class="hilite"><?php echo w2p_url($company->company_primary_url); ?> </td> </tr> <tr> <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Type'); ?> :</td> <td class="hilite"><?php echo $AppUI->_($types[$company->company_type]); ?> </td> </tr> </table> </td>
/** * Tests the proper creation of a link */ public function test_w2p_url() { $target = '<a href="http://web2project.net" target="_new">http://web2project.net</a>'; $linkText = w2p_url('http://web2project.net'); $this->assertEquals($target, $linkText); $target = ''; $linkText = w2p_url(''); $this->assertEquals($target, $linkText); $target = '<a href="http://web2project.net" target="_new">web2project</a>'; $linkText = w2p_url('http://web2project.net', 'web2project'); $this->assertEquals($target, $linkText); }
<img align="right" border="0" src="<?php echo w2PfindImage('googlemaps.gif'); ?> " width="55" height="22" alt="Find It on Google" /></a> <?php echo $department->dept_address1 . ($department->dept_address2 ? '<br />' . $department->dept_address2 : '') . '<br />' . $department->dept_city . ' ' . $department->dept_state . ' ' . $department->dept_zip . ($department->dept_country ? '<br />' . $countries[$department->dept_country] : ''); ?> </td> </tr> <tr> <td align="right" nowrap="nowrap"><?php echo $AppUI->_('URL'); ?> :</td> <td class="hilite"><?php echo w2p_url($department->dept_url); ?> </td> </tr> </table> </td> <td width="50%"> <strong><?php echo $AppUI->_('Description'); ?> </strong> <table cellspacing="1" cellpadding="2" border="0" width="100%"> <tr> <td class="hilite" width="100%"><?php echo w2p_textarea($department->dept_desc); ?>
/** * @deprecated */ public static function renderColumn(w2p_Core_CAppUI $AppUI, $fieldName, $row) { global $w2Pconfig; trigger_error("The static method renderColumn has been deprecated and will be removed by v4.0.", E_USER_NOTICE); $last_underscore = strrpos($fieldName, '_'); $suffix = $last_underscore !== false ? substr($fieldName, $last_underscore) : $fieldName; switch ($suffix) { case '_creator': case '_owner': $s .= w2PgetUsernameFromID($row[$fieldName]); break; case '_budget': $s = $w2Pconfig['currency_symbol']; $s .= formatCurrency($row[$fieldName], $AppUI->getPref('CURRENCYFORM')); break; case '_url': $s = w2p_url($row[$fieldName]); break; case '_date': $df = $AppUI->getPref('SHDATEFORMAT'); $myDate = intval($row[$fieldName]) ? new w2p_Utilities_Date($row[$fieldName]) : null; $s = $myDate ? $myDate->format($df) : '-'; break; default: $s = htmlspecialchars($row[$fieldName], ENT_QUOTES); } return '<td nowrap="nowrap">' . $s . '</td>'; }
<td align="right" nowrap="nowrap"><?php echo $AppUI->_('URL'); ?> :</td> <td class="hilite"><?php echo w2p_url($project->project_url); ?> </td> </tr> <tr> <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Staging URL'); ?> :</td> <td class="hilite"><?php echo w2p_url($project->project_demo_url); ?> </td> </tr> <tr> <td colspan="2"> <?php $custom_fields = new CustomFields($m, $a, $project->project_id, 'view'); $custom_fields->printHTML(); ?> </td> </tr> <tr> <td colspan="2"> <strong><?php echo $AppUI->_('Description');
<td align="right" nowrap="nowrap"><?php echo $AppUI->_('URL'); ?> :</td> <td class="hilite"><?php echo w2p_url($obj->project_url); ?> </td> </tr> <tr> <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Staging URL'); ?> :</td> <td class="hilite"><?php echo w2p_url($obj->project_demo_url); ?> </td> </tr> <tr> <td colspan="2"> <?php $custom_fields = new w2p_Core_CustomFields('projects', $a, $obj->project_id, 'view'); $custom_fields->printHTML(); ?> </td> </tr> <tr> <td colspan="2"> <strong><?php echo $AppUI->_('Description');