예제 #1
0
if (isset($_POST['show_task_options'])) {
    $AppUI->setState('TaskListShowIncomplete', w2PgetParam($_POST, 'show_incomplete', 0));
}
$showIncomplete = $AppUI->getState('TaskListShowIncomplete', 0);
// get CCompany() to filter tasks by company
$obj = new CCompany();
$companies = $obj->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name');
$filters2 = arrayMerge(array('allcompanies' => $AppUI->_('All Companies', UI_OUTPUT_RAW)), $companies);
// setup the title block
$titleBlock = new w2p_Theme_TitleBlock('Tasks', 'applet-48.png', $m, $m . '.' . $a);
// patch 2.12.04 text to search entry box
if (isset($_POST['searchtext'])) {
    $AppUI->setState('searchtext', $_POST['searchtext']);
}
$search_text = $AppUI->getState('searchtext') ? $AppUI->getState('searchtext') : '';
$search_text = w2PformSafe($search_text, true);
$titleBlock->addCell('     ' . $AppUI->_('Search') . ':');
$titleBlock->addCell('<input type="text" class="text" size="20" name="searchtext" onChange="document.searchfilter.submit();" value="' . $search_text . '" title="' . $AppUI->_('Search in name and description fields') . '"/>', '', '<form action="?m=tasks" method="post" id="searchfilter" accept-charset="utf-8">', '</form>');
// Let's see if this user has admin privileges
if (canView('admin')) {
    $titleBlock->addCell();
    $titleBlock->addCell($AppUI->_('User') . ':');
    $user_list = $perms->getPermittedUsers('tasks');
    $titleBlock->addCell(arraySelect($user_list, 'user_id', 'size="1" class="text" onChange="document.userIdForm.submit();"', $user_id, false), '', '<form action="?m=tasks" method="post" name="userIdForm" accept-charset="utf-8">', '</form>');
}
$titleBlock->addCell();
$titleBlock->addCell($AppUI->_('Company') . ':');
$titleBlock->addCell(arraySelect($filters2, 'f2', 'size="1" class="text" onChange="document.companyFilter.submit();"', $f2, false), '', '<form action="?m=tasks" method="post" name="companyFilter" accept-charset="utf-8">', '</form>');
$titleBlock->addCell();
if ($canEdit && $project_id) {
    $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new task') . '">', '', '<form action="?m=tasks&amp;a=addedit&amp;task_project=' . $project_id . '" method="post" accept-charset="utf-8">', '</form>');
예제 #2
0
						  </table>
					  </td>
						<?php 
            if ($w2Pconfig['direct_edit_assignment']) {
                ?>
							  <td colspan="3" align="right" valign="middle">
								  <table width="100%" border="0">
									  <tr>
											<td align="right">
												<select name="add_users" style="width:200px" size="2" multiple="multiple" class="text" ondblclick="javascript:chAssignment(<?php 
                echo $p['project_id'];
                ?>
, 0, false)">
													<?php 
                foreach ($userAlloc as $v => $u) {
                    echo '<option value="' . $u['user_id'] . '">' . w2PformSafe($u['userFC']) . "</option>\n";
                }
                ?>
												</select>
											</td>
											<td align="center">
												<?php 
                echo '<a href="javascript:chAssignment(' . $p['project_id'] . ', 0, 0);">' . w2PshowImage('add.png', 16, 16, 'Assign Users', 'Assign selected Users to selected Tasks', 'tasks') . "</a>\n";
                echo '<a href="javascript:chAssignment(' . $p['project_id'] . ', 1, 1);">' . w2PshowImage('remove.png', 16, 16, 'Unassign Users', 'Unassign Users from Task', 'tasks') . "</a>\n";
                ?>
												<br />
												<select class="text" name="percentage_assignment" title="<?php 
                echo $AppUI->_('Assign with Percentage');
                ?>
" >
													<?php 
예제 #3
0
}
$tab = $AppUI->processIntState('UserIdxTab', $_GET, 'tab', 0);
$perms =& $AppUI->acl();
if (!canView('users')) {
    $AppUI->redirect(ACCESS_DENIED);
}
if (isset($_GET['stub'])) {
    $AppUI->setState('UserIdxStub', w2PgetParam($_GET, 'stub', null));
    $AppUI->setState('UserIdxWhere', '');
} elseif (isset($_POST['search_string'])) {
    $AppUI->setState('UserIdxWhere', $_POST['search_string']);
    $AppUI->setState('UserIdxStub', '');
}
$stub = $AppUI->getState('UserIdxStub');
$where = $AppUI->getState('UserIdxWhere');
$where = w2PformSafe($where, true);
if (isset($_GET['orderby'])) {
    $AppUI->setState('UserIdxOrderby', w2PgetParam($_GET, 'orderby', null));
}
$orderby = $AppUI->getState('UserIdxOrderby') ? $AppUI->getState('UserIdxOrderby') : 'user_username';
$orderby = $tab == 3 || $orderby != 'date_time_in' && $orderby != 'user_ip' ? $orderby : 'user_username';
// Pull First Letters
$letters = CUser::getFirstLetters();
$letters = $letters . CContact::getFirstLetters($AppUI->user_id, true);
$a2z = '<a href="./index.php?m=users&stub=0">' . $AppUI->_('All') . '</a>&nbsp;&nbsp;&nbsp;&nbsp;';
for ($c = 65; $c < 91; $c++) {
    $cu = chr($c);
    $cell = !(mb_strpos($letters, $cu) === false) ? '<a href="?m=users&stub=' . $cu . '">' . $cu . '</a>' : '<font color="#999999">' . $cu . '</font>';
    $a2z .= $cell . '&nbsp;';
}
// setup the title block
예제 #4
0
    $i = 0;
    for ($y = 0; $y <= $carrWidth; $y++) {
        $x = 0;
        while ($x < $t && isset($rows[$i]) && ($row = $rows[$i])) {
            $carr[$y][] = $row;
            $x++;
            $i++;
        }
    }
}
$tdw = floor(100 / $carrWidth);
/**
 * Contact search form
 */
// Let's remove the first '%' that we previously added to ContIdxWhere
$default_search_string = w2PformSafe(substr($AppUI->getState('ContIdxWhere'), '', strlen($AppUI->getState('ContIdxWhere'))), true);
$form = '<form action="./index.php" method="get" accept-charset="utf-8">' . $AppUI->_('Search for') . '
           <input type="text" class="text" name="search_string" value="' . $default_search_string . '" />
		   <input type="hidden" name="m" value="contacts" />
		   <input type="submit" value=">" />
		   <a href="./index.php?m=contacts&amp;search_string=0">' . $AppUI->_('Reset search') . '</a>
		 </form>';
// En of contact search form
$a2z = '<table cellpadding="2" cellspacing="1" border="0">';
$a2z .= '<tr>';
$a2z .= '<td width="100%" align="right">' . $AppUI->_('Show') . ': </td>';
$a2z .= '<td><a href="./index.php?m=contacts&where=0">' . $AppUI->_('All') . '</a></td>';
// Pull First Letters
$letters = CContact::getFirstLetters($AppUI->user_id);
for ($c = 65; $c < 91; $c++) {
    $cu = chr($c);
예제 #5
0
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
$tab = $AppUI->processIntState('ProjIdxTab', $_GET, 'tab', 5);
$project = new CProject();
$structprojs = $project->getProjects();
$search_string = w2PgetParam($_POST, 'search_string', '');
$AppUI->setState($m . '_search_string', $search_string);
$search_string = w2PformSafe($search_string, true);
$canCreate = $project->canCreate();
$company_id = w2PgetConfig('company_filter_default', 'user') == 'user' ? $AppUI->user_company : '-1';
$orderby = isset($_GET['orderby']) && property_exists('CProject', $_GET['orderby']) ? $_GET['orderby'] : 'project_name';
$project_type = $AppUI->processIntState('ProjIdxType', $_POST, 'project_type', -1);
$owner = $AppUI->processIntState('ProjIdxowner', $_POST, 'project_owner', -1);
$orderdir = $AppUI->getState('ProjIdxOrderDir') ? $AppUI->getState('ProjIdxOrderDir') : 'asc';
if (isset($_GET['orderby'])) {
    if ($AppUI->getState('ProjIdxOrderDir') == 'asc') {
        $orderdir = 'desc';
    } else {
        $orderdir = 'asc';
    }
}
$AppUI->setState('ProjIdxOrderDir', $orderdir);
// collect the full projects list data via function in projects.class.php
$search_text = $search_string;
// @note this is only because the projects_list_data function takes a bunch of globals
//$projects = projects_list_data();
$oCompany = new CCompany();
$allowedCompanies[-1] = $AppUI->_('all');
예제 #6
0
if ($obj->resource_max_allocation) {
    echo w2PformSafe($obj->resource_max_allocation);
} else {
    echo '100';
}
?>
"
		name="resource_max_allocation" /></td>
	</tr>
	<tr>
		<td align="right"><?php 
echo $AppUI->_('Notes');
?>
</td>
		<td><textarea name="resource_note" cols="60" rows="7"><?php 
echo w2PformSafe($obj->resource_note);
?>
</textarea></td>
	</tr>	
	</table>
</td>
</tr>
<tr>
	<td>
    	<input type="button" value="<?php 
echo $AppUI->_('back');
?>
" class="button" onclick="javascript:history.back(-1);" />
	</td>
  	<td align="right">
    	<input type="button" value="<?php 
 public function parseViewField($key)
 {
     $field_config = unserialize($this->fields_array[$key]);
     $parsed = '<tr id="custom_tr_' . $key . '">';
     $parsed .= $this->_getLabelHTML($field_config);
     switch ($field_config['type']) {
         case 'text':
             $parsed .= '<td class="hilite">' . w2PformSafe(isset($this->previous_data[$key]) ? $this->previous_data[$key] : '') . '</td>';
             break;
         case 'href':
             $parsed .= '<td class="hilite"><a href="' . w2PformSafe(isset($this->previous_data[$key]) ? $this->previous_data[$key] : '') . '">' . w2PformSafe(isset($this->previous_data[$key]) ? $this->previous_data[$key] : '') . '</a></td>';
             break;
         case 'select':
             $optionarray = explode(',', $field_config['selects']);
             $parsed .= '<td class="hilite" width="300">' . w2PformSafe(isset($this->previous_data[$key]) ? $optionarray[$this->previous_data[$key]] : '') . '</td>';
             break;
         case 'textarea':
             $parsed .= '<td valign="top" class="hilite">' . w2PformSafe(isset($this->previous_data[$key]) ? $this->previous_data[$key] : '') . '</td>';
             break;
         case 'checkbox':
             $optionarray = explode(',', $field_config['selects']);
             $parsed .= '<td align="left">';
             foreach ($optionarray as $option) {
                 $checked = '';
                 if (isset($this->previous_data[$key]) && array_key_exists($option, array_flip($this->previous_data[$key]))) {
                     $checked = 'checked';
                 }
                 $parsed .= '<input type="checkbox" value="' . $option . '" name="custom_' . $key . '[]" class="text" locked style="border:0" ' . $checked . ' ' . $field_config['options'] . ' disabled />' . $option . '<br />';
             }
             $parsed .= '</td>';
             break;
     }
     $parsed .= '</tr>';
     return $parsed;
 }
예제 #8
0
function showRow($id = '', $key = 0, $title = '', $value = '')
{
    global $canEdit, $sysval_id, $AppUI, $keys;
    global $fixedSysVals;
    $s = '';
    if ($sysval_id == $title && $canEdit) {
        // edit form
        $s .= '<tr><td><input type="hidden" name="sysval_id" value="' . $title . '" />&nbsp;</td>';
        $s .= '<td valign="top"><a name="' . $title . '"> </a>' . arraySelect($keys, 'sysval_key_id', 'size="1" class="text"', $key) . '</td>';
        $s .= '<td valign="top"><input type="text" name="sysval_title" value="' . w2PformSafe($title) . '" class="text" /></td>';
        $s .= '<td valign="top"><textarea name="sysval_value" class="small" rows="5" cols="40">' . $value . '</textarea></td>';
        $s .= '<td><input type="submit" value="' . $AppUI->_($id ? 'save' : 'add') . '" class="button" /></td><td>&nbsp;</td>';
    } else {
        $s = '<tr><td width="12" valign="top">';
        if ($canEdit) {
            $s .= '<a href="?m=system&u=syskeys&sysval_id=' . $title . '#' . $title . '" title="' . $AppUI->_('edit') . '">' . w2PshowImage('icons/stock_edit-16.png', 16, 16, '') . '</a></td>';
        }
        $s .= '<td valign="top">' . $keys[$key] . '</td>';
        $s .= '<td valign="top">' . w2PformSafe($title) . '</td>';
        $s .= '<td valign="top" colspan="2">' . $value . '</td>';
        $s .= '<td valign="top" width="16">';
        if ($canEdit && !in_array($title, $fixedSysVals)) {
            $s .= '<a href="javascript:delIt(\'' . $title . '\')" title="' . $AppUI->_('delete') . '">' . w2PshowImage('icons/stock_delete-16.png', 16, 16, '') . '</a>';
        }
        $s .= '</td>';
    }
    $s .= '</tr>';
    return $s;
}
예제 #9
0
$AppUI->savePlace();
$structprojs = getProjects();
// Let's update project status!
if (isset($_GET['update_project_status']) && isset($_GET['project_status']) && isset($_GET['project_id'])) {
    $projects_id = w2PgetParam($_GET, 'project_id', array());
    // This must be an array
    $statusId = w2PgetParam($_GET, 'project_status', 0);
    $project = new CProject();
    foreach ($projects_id as $project_id) {
        $project->load($project_id);
        $project->project_status = $statusId;
        $project->store($AppUI);
    }
}
if (isset($_POST['projsearchtext'])) {
    $AppUI->setState('projsearchtext', w2PformSafe($_POST['projsearchtext'], true));
}
$search_text = $AppUI->getState('projsearchtext') !== null ? $AppUI->getState('projsearchtext') : '';
$projectDesigner = $AppUI->getState('ProjIdxProjectDesigner') !== null ? $AppUI->getState('ProjIdxProjectDesigner') : 0;
$tab = $AppUI->processIntState('ProjIdxTab', $_GET, 'tab', 1);
$currentTabId = $tab;
$active = intval(!$AppUI->getState('ProjIdxTab'));
$oCompany = new CCompany();
$allowedCompanies = $oCompany->getAllowedRecords($AppUI->user_id, 'company_id,company_name');
if (isset($_POST['company_id'])) {
    $AppUI->setState('ProjIdxCompany', intval($_POST['company_id']));
}
$company_id = $AppUI->getState('ProjIdxCompany') !== null ? $AppUI->getState('ProjIdxCompany') : (isset($allowedCompanies[$AppUI->user_company]) ? $AppUI->user_company : 0);
$company_prefix = 'company_';
if (isset($_POST['department'])) {
    $AppUI->setState('ProjIdxDepartment', $_POST['department']);
예제 #10
0
:<br/>
                                </td>
                                <td colspan="3">
                                    <?php 
echo projectSelectWithOptGroup($AppUI->user_id, 'import_tasks_from', 'size="1" class="text"', false, $project_id);
?>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="4">
                                    <?php 
echo $AppUI->_('Description');
?>
<br />
                                    <textarea name="project_description" cols="50" rows="10" class="textarea"><?php 
echo w2PformSafe($project->project_description);
?>
</textarea>
                                </td>
                            </tr>
                            <tr valign="middle">
                                <table cellspacing="0" cellpadding="2" border="0" width="100%">
                                <tr>
                                    <td valign="middle"><?php 
echo $AppUI->_('Notify by Email');
?>
:
                                        <input type="checkbox" name="email_project_owner_box" id="email_project_owner_box" <?php 
echo $tt ? 'checked="checked"' : '';
?>
 />
예제 #11
0
    $s .= '</td><td>';
    $langs['english'] = w2PformSafe($langs['english'], true);
    if ($lang == 'en') {
        if (mb_strlen($langs['english']) < 40) {
            $s .= '<input type="text" name="trans[' . $index . '][english]" value="' . $langs['english'] . '" size="40" class="text" />';
        } else {
            $rows = round(mb_strlen($langs['english'] / 35)) + 1;
            $s .= '<textarea name="trans[' . $index . '][english]"  cols="40" class="small" rows="' . $rows . '">' . $langs['english'] . '</textarea>';
        }
    } else {
        $s .= $langs['english'];
        $s .= '<input type="hidden" name="trans[' . $index . '][english]" value="' . ($k ? $k : $langs['english']) . '" size="20" class="text" />';
    }
    $s .= '</td><td>';
    if ($lang != 'en') {
        $langs['lang'] = w2PformSafe($langs['lang'], true);
        if (mb_strlen($langs['lang']) < 40) {
            $s .= '<input type="text" name="trans[' . $index . '][lang]" value="' . $langs['lang'] . '" size="40" class="text" />';
        } else {
            $rows = round(mb_strlen($langs['lang'] / 35)) + 1;
            $s .= '<textarea name="trans[' . $index . '][lang]" cols="40" class="small" rows="' . $rows . '">' . $langs['lang'] . '</textarea>';
        }
    }
    $s .= '</td><td align="center"><input type="checkbox" name="trans[' . $index . '][del]" /></td></tr>';
    $index++;
}
echo $s;
?>
<tr>
	<td colspan="4" align="right">
		<input type="submit" value="<?php 
예제 #12
0
파일: index.php 프로젝트: joly/web2project
    $i = 0;
    for ($y = 0; $y <= $carrWidth; $y++) {
        $x = 0;
        while ($x < $t && isset($rows[$i]) && ($row = $rows[$i])) {
            $carr[$y][] = $row;
            $x++;
            $i++;
        }
    }
}
$tdw = floor(100 / $carrWidth);
/**
 * Contact search form
 */
// Let's remove the first '%' that we previously added to ContIdxWhere
$default_search_string = w2PformSafe($AppUI->getState('ContIdxWhere'), true);
$form = '<form action="./index.php" method="get" accept-charset="utf-8">' . $AppUI->_('Search for') . '
           <input type="text" class="text" name="search_string" value="' . $default_search_string . '" />
		   <input type="hidden" name="m" value="contacts" />
		   <input type="submit" value=">" />
		   <a href="./index.php?m=contacts&amp;search_string=0">' . $AppUI->_('Reset search') . '</a>
		 </form>';
// En of contact search form
$a2z = '<table cellpadding="2" cellspacing="1" border="0">';
$a2z .= '<tr>';
$a2z .= '<td width="100%" align="right">' . $AppUI->_('Show') . ': </td>';
$a2z .= '<td><a href="./index.php?m=contacts&where=0">' . $AppUI->_('All') . '</a></td>';
// Pull First Letters
$letters = CContact::getFirstLetters($AppUI->user_id);
for ($c = 65; $c < 91; $c++) {
    $cu = chr($c);
예제 #13
0
function displayTask($list, $task, $level, $display_week_hours, $fromPeriod, $toPeriod, $user_id)
{
    global $AppUI, $df, $durnTypes, $log_userfilter_users, $now, $priority, $system_users, $z, $zi, $x, $userAlloc, $projects;
    //if the user has no permission to the project don't show the tasks
    if (!key_exists($task->task_project, $projects)) {
        return;
    }
    $zi++;
    $users = $task->task_assigned_users;
    $task->userPriority = $task->getUserSpecificTaskPriority($user_id);
    $project = $task->getProject();
    $tmp = '<tr>';
    $tmp .= '<td align="center" nowrap="nowrap">';
    $tmp .= '<input type="checkbox" name="selected_task[' . $task->task_id . ']" value="' . $task->task_id . '" />';
    $tmp .= '</td>';
    $tmp .= '<td align="center" nowrap="nowrap">';
    if ($task->userPriority < 0) {
        $tmp .= '<img src="' . w2PfindImage('icons/priority-' . -$task->userPriority . '.gif') . '" width="13" height="16">';
    } elseif ($task->userPriority > 0) {
        $tmp .= '<img src="' . w2PfindImage('icons/priority+' . $task->userPriority . '.gif') . '" width="13" height="16">';
    }
    $tmp .= '</td>';
    $tmp .= '<td>';
    for ($i = 0; $i < $level; $i++) {
        $tmp .= '&#160';
    }
    if ($task->task_milestone == true) {
        $tmp .= '<b>';
    }
    if ($level >= 1) {
        $tmp .= w2PshowImage('corner-dots.gif', 16, 12, 'Subtask', '', 'tasks') . '&nbsp;';
    }
    $tmp .= '<a href="?m=tasks&a=view&task_id=' . $task->task_id . '">' . $task->task_name . '</a>';
    if ($task->task_milestone == true) {
        $tmp .= '</b>';
    }
    if ($task->task_priority < 0) {
        $tmp .= '&nbsp;(<img src="' . w2PfindImage('icons/priority-' . -$task->task_priority . '.gif') . '" width="13" height="16" />)';
    } elseif ($task->task_priority > 0) {
        $tmp .= '&nbsp;(<img src="' . w2PfindImage('icons/priority+' . $task->task_priority . '.gif') . '" width="13" height="16" />)';
    }
    $tmp .= '</td>';
    $tmp .= '<td align="left">';
    $tmp .= '<a href="?m=projects&a=view&project_id=' . $task->task_project . '" style="background-color:#' . $project['project_color_identifier'] . '; color:' . bestColor($project['project_color_identifier']) . '">' . $project['project_short_name'] . '</a>';
    $tmp .= '</td>';
    $tmp .= '<td align="right" nowrap="nowrap">';
    $tmp .= $task->task_duration . '&nbsp;' . mb_substr($AppUI->_($durnTypes[$task->task_duration_type]), 0, 1);
    $tmp .= '</td>';
    $tmp .= '<td align="center" nowrap="nowrap">';
    $dt = new CDate($task->task_start_date);
    $tmp .= $dt->format($df);
    $tmp .= '&#160&#160&#160</td>';
    $tmp .= '<td align="right" nowrap="nowrap">';
    $ed = new CDate($task->task_end_date);
    $dt = $now->dateDiff($ed);
    $sgn = $now->compare($ed, $now);
    $tmp .= $dt * $sgn;
    $tmp .= '</td>';
    if ($display_week_hours) {
        $tmp .= displayWeeks($list, $task, $level, $fromPeriod, $toPeriod);
    }
    $tmp .= '<td>';
    $sep = $us = '';
    foreach ($users as $key => $row) {
        if ($row['user_id']) {
            $us .= '<a href="?m=admin&a=viewuser&user_id=' . $row[0] . '">' . $sep . $row['contact_first_name'] . '&nbsp;' . $row['contact_last_name'] . '&nbsp;(' . $row['perc_assignment'] . '%)</a>';
            $sep = ', ';
        }
    }
    $tmp .= $us;
    $tmp .= '</td>';
    // create the list of possible assignees
    if ($zi == 1) {
        //  selectbox may not have a size smaller than 2, use 5 here as minimum
        $zz = $z < 5 ? 5 : $z * 1.5;
        if (sizeof($users) >= 7) {
            $zz = $zz * 2;
        }
        $zm1 = $z - 2;
        if ($zm1 == 0) {
            $zm1 = 1;
        }
        $assUser = $userAlloc[$user_id]['userFC'];
        if ($user_id == 0) {
            // need to handle orphaned tasks different from tasks with existing assignees
            $zm1++;
        }
        $tmp .= '<td valign="top" align="center" nowrap="nowrap">';
        $tmp .= '<select name="add_users" style="width:200px" size="10" class="text" multiple="multiple" ondblclick="javascript:chAssignment(' . $user_id . ', 0, false)">';
        foreach ($userAlloc as $v => $u) {
            $tmp .= '<option value="' . $u['user_id'] . '">' . w2PformSafe($u['userFC']) . '</option>';
        }
        $tmp .= '</select>';
        $tmp .= '</td>';
    }
    $tmp .= '</tr>';
    return $tmp;
}
예제 #14
0
					</tr>
					<tr>
						<td align="right"><?php 
echo $AppUI->_('Country');
?>
:</td>
						<td>
							<?php 
echo arraySelect($countries, 'company_country', 'size="1" class="text"', $company->company_country ? $company->company_country : 0);
?>
						</td>
					</tr>
					<tr>
						<td align="right">
							URL http://<a name="x"></a></td><td><input type="text" class="text" value="<?php 
echo w2PformSafe($company->company_primary_url);
?>
" name="company_primary_url" size="50" maxlength="255" />
							<a href="javascript: void(0);" onclick="testURL('CompanyURLOne')">[<?php 
echo $AppUI->_('test');
?>
]</a>
						</td>
					</tr>	
					<tr>
						<td align="right"><?php 
echo $AppUI->_('Company Owner');
?>
:</td>
						<td>
							<?php 
예제 #15
0
 public function addField($fieldName, $fieldValue, $options = array(), $values = array())
 {
     $pieces = explode('_', $fieldName);
     $suffix = end($pieces);
     $params = '';
     foreach ($options as $key => $value) {
         $params .= $key . '="' . $value . '" ';
     }
     switch ($suffix) {
         case 'company':
             $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;
         case 'desc':
             // @todo This is a special case because department->dept_notes should be renamed department->dept_description
         // @todo This is a special case because department->dept_notes should be renamed department->dept_description
         case 'note':
             // @todo This is a special case because resource->resource_note should be renamed resource->resource_description
         // @todo This is a special case because resource->resource_note should be renamed resource->resource_description
         case 'notes':
             // @todo This is a special case because contact->contact_notes should be renamed contact->contact_description
         // @todo This is a special case because contact->contact_notes should be renamed contact->contact_description
         case 'signature':
             // @todo This is a special case because user->user_signature should be renamed to something else..?
         // @todo This is a special case because user->user_signature should be renamed to something else..?
         case 'description':
             $output = '<textarea name="' . $fieldName . '" class="' . $suffix . '">' . w2PformSafe($fieldValue) . '</textarea>';
             break;
         case 'birthday':
             // @todo This is a special case because contact->contact_birthday should be renamed contact->contact_birth_date
             $myDate = intval($fieldValue) ? new w2p_Utilities_Date($fieldValue) : null;
             $date = $myDate ? $myDate->format('%Y-%m-%d') : '-';
             $output = '<input type="text" class="text ' . $suffix . '" ';
             $output .= 'name="' . $fieldName . '" value="' . w2PformSafe($date) . '" ' . $params . ' />';
             break;
         case 'date':
             $date = $fieldValue ? new w2p_Utilities_Date($fieldValue) : null;
             unset($pieces[0]);
             $datename = implode('_', $pieces);
             $output = '<input type="hidden" name="' . $fieldName . '" id="' . $fieldName . '" value="' . ($date ? $date->format(FMT_TIMESTAMP_DATE) : '') . '" />';
             $output .= '<input type="text" name="' . $datename . '" id="' . $datename . '" onchange="setDate_new(\'editFrm\', \'' . $datename . '\');" value="' . ($date ? $date->format($this->df) : '') . '" class="text" />';
             $output .= '<a href="javascript: void(0);" onclick="return showCalendar(\'' . $datename . '\', \'' . $this->df . '\', \'editFrm\', null, true, true)">';
             $output .= '<img src="' . w2PfindImage('calendar.gif') . '" alt="' . $this->AppUI->_('Calendar') . '" />';
             $output .= '</a>';
             break;
         case 'private':
         case 'updateask':
             // @todo This is unique to the contacts module
             $output = '<input type="checkbox" value="1" class="text ' . $suffix . '" ';
             $output .= 'name="' . $fieldName . '" ' . $params . ' />';
             break;
         case 'parent':
             // @note This drops through on purpose
             $suffix = 'department';
         case 'allocation':
         case 'category':
         case 'country':
         case 'owner':
         case 'priority':
         case 'project':
         case 'status':
         case 'type':
             $output = arraySelect($values, $fieldName, 'size="1" class="text ' . $suffix . '"', $fieldValue);
             break;
         case 'url':
             $output = 'http://<input type="text" class="text ' . $suffix . '" ';
             $output .= 'name="' . $fieldName . '" value="' . w2PformSafe($fieldValue) . '" ' . $params . ' />';
             $output .= '<a href="javascript: void(0);" onclick="testURL()">[' . $this->AppUI->_('test') . ']</a>';
             break;
             /**
              * This handles the default input text input box. It currently covers these fields:
              *   all names, email, phone1, phone2, url, address1, address2, city, state, zip, fax, title, job
              */
         /**
          * This handles the default input text input box. It currently covers these fields:
          *   all names, email, phone1, phone2, url, address1, address2, city, state, zip, fax, title, job
          */
         default:
             $output = '<input type="text" class="text ' . $suffix . '" ';
             $output .= 'name="' . $fieldName . '" value="' . w2PformSafe($fieldValue) . '" ' . $params . ' />';
     }
     return $output;
 }