示例#1
0
 public function index()
 {
     if ($_SESSION['access'] > 2) {
         die('Access denied');
     }
     $this->templates_path = dirname(dirname(dirname(__FILE__))) . ROOT_DIR . 'view';
     $this->tpl_file = isset($_GET['file']) ? $this->templates_path . $_GET['file'] : false;
     if (isset($_POST['action']) && $_POST['action'] == 'save' && $this->tpl_file != false) {
         $this->saveTemplate();
     }
     if (isset($_SESSION['msg']) && $_SESSION['msg'] == 'success') {
         $this->data['text_message'] = $this->language['changes_applied'];
         $this->data['class_message'] = 'success';
         unset($_SESSION['msg']);
     }
     if (isset($_SESSION['msg']) && $_SESSION['msg'] == 'denied') {
         $this->data['text_message'] = $this->language['perm_denied'] . ' ' . $this->language['cur_perm'] . getPermission($this->tpl_file);
         $this->data['class_message'] = 'error';
         unset($_SESSION['msg']);
     }
     $this->engine->document->addHeaderString('<link href="template/css/codemirror.css" rel="stylesheet" media="screen">');
     $this->engine->document->addHeaderString('<script src="template/js/codemirror.js"></script>');
     if ($this->tpl_file != false) {
         $ext = strtolower(pathinfo($this->tpl_file, PATHINFO_EXTENSION));
         if (in_array($ext, array('png', 'jpg', 'jpeg', 'gif'))) {
             $this->tpl_file = false;
         }
         switch ($ext) {
             case 'css':
                 $this->engine->document->addHeaderString('<script src="template/js/css.js"></script>');
                 break;
             case 'xml':
                 $this->engine->document->addHeaderString('<script src="template/js/xml.js"></script>');
                 break;
             case 'js':
                 $this->engine->document->addHeaderString('<script src="template/js/javascript.js"></script>');
                 break;
             case 'tpl':
                 $this->engine->document->addHeaderString('<script src="template/js/matchbrackets.js"></script>');
                 $this->engine->document->addHeaderString('<script src="template/js/htmlmixed.js"></script>');
                 $this->engine->document->addHeaderString('<script src="template/js/xml.js"></script>');
                 $this->engine->document->addHeaderString('<script src="template/js/javascript.js"></script>');
                 $this->engine->document->addHeaderString('<script src="template/js/css.js"></script>');
                 $this->engine->document->addHeaderString('<script src="template/js/clike.js"></script>');
                 $this->engine->document->addHeaderString('<script src="template/js/php.js"></script>');
                 break;
             default:
                 break;
         }
     }
     $this->engine->document->addHeaderString('<script src="template/js/jquery.cookie.js"></script>');
     $this->engine->document->addHeaderString('<script src="template/js/jquery.treeview.js"></script>');
     $this->engine->document->addHeaderString('<link href="template/css/jquery.treeview.css" rel="stylesheet" media="screen">');
     $this->data['templates_path'] = $this->templates_path;
     $this->data['tpl_file'] = $this->tpl_file;
     $this->data['ext'] = isset($ext) ? $ext : '';
     $this->data['breadcrumbs'][] = array('caption' => $this->language['home'], 'link' => ADM_PATH);
     $this->data['breadcrumb_cur'] = $this->language['template_manager'];
     $this->template = 'template/tpl_manager.tpl';
 }
示例#2
0
 function fetchResults(&$record_count)
 {
     global $AppUI;
     $results = $this->_searchResults();
     if ($results && getPermission($this->table_module, 'access')) {
         $record_count += count($results);
         $outstring = '<tr><th><b>' . $AppUI->_($this->table_title) . ' (' . count($results) . ')' . '</b></th></tr>' . "\n";
         foreach ($results as $records) {
             if (getPermission($this->table_module, 'access', $records[$this->table_key])) {
                 $ii = 0;
                 $display_val = '';
                 foreach ($this->display_fields as $fld) {
                     $ii++;
                     if (!($this->search_options['display_all_flds'] == 'on') && $ii > 2) {
                         break;
                     }
                     $display_val .= ($display_val ? ' ' : '') . $records[preg_replace('/^.*\\.([^\\.]+)$/', '$1', $fld)];
                 }
                 $tmplink = "";
                 if (isset($this->table_link) && isset($this->table_key)) {
                     $tmplink = $this->table_link . $records[preg_replace('/^.*\\.([^\\.]+)$/', '$1', $this->table_key)];
                 }
                 if (isset($this->table_link2) && isset($this->table_key2)) {
                     $tmplink = $this->table_link . $records[preg_replace('/^.*\\.([^\\.]+)$/', '$1', $this->table_key)] . $this->table_link2 . $records[preg_replace('/^.*\\.([^\\.]+)$/', '$1', $this->table_key2)];
                 }
                 $outstring .= '<tr><td>' . "\n" . '<a href="' . $tmplink . '">' . highlight($display_val, $this->keywords) . '</a>' . "\n" . '</td></tr>' . "\n";
             }
         }
     } else {
         if ($this->search_options['show_empty'] == 'on') {
             $outstring = '<tr><th><b>' . $AppUI->_($this->table_title) . ' (' . count($results) . ')' . '</b></th></tr>' . "\n" . '<tr><td>' . $AppUI->_('Empty') . '</td></tr>' . "\n";
         }
     }
     return $outstring;
 }
示例#3
0
function tombolAddItem($kd, $status)
{
    if (getPermission()) {
        if (getPermission()->BTN_EDIT == 1 and $status != 101) {
            $title1 = Yii::t('app', 'AddItem');
            $options1 = ['id' => 'add-item', 'data-toggle' => "modal", 'data-target' => "#additem-ro", 'class' => 'btn btn-warning'];
            $icon1 = '<span class="fa fa-plus fa-lg"></span>';
            $label1 = $icon1 . ' ' . $title1;
            $url1 = Url::toRoute(['/purchasing/request-order/additem', 'kd' => $kd]);
            $content = Html::a($label1, $url1, $options1);
            return $content;
        } else {
            $title1 = Yii::t('app', 'AddItem');
            $options1 = ['id' => 'ro-tambah-detail', 'class' => 'btn btn-warning', 'data-confirm' => 'Permission Failed, The data can not be changed !'];
            $icon1 = '<span class="fa fa-plus fa-lg"></span>';
            $label1 = $icon1 . ' ' . $title1;
            $url1 = Url::toRoute(['#']);
            $content = Html::a($label1, $url1, $options1);
            return $content;
        }
    } else {
        $title1 = Yii::t('app', 'AddItem');
        $options1 = ['id' => 'ro-tambah-detail', 'class' => 'btn btn-warning', 'data-confirm' => 'Permission Failed, The data can not be changed  !'];
        $icon1 = '<span class="fa fa-plus fa-lg"></span>';
        $label1 = $icon1 . ' ' . $title1;
        $url1 = Url::toRoute(['#']);
        $content = Html::a($label1, $url1, $options1);
        return $content;
    }
}
示例#4
0
function tombolReview($url, $model)
{
    if (getPermission()) {
        // if(getPermission()->BTN_REVIEW==1){
        $title = Yii::t('app', 'Review');
        $options = ['id' => 'term-date-review'];
        $icon = '<span class="glyphicon glyphicon-zoom-in"></span>';
        $label = $icon . ' ' . $title;
        $url = Url::toRoute(['/purchasing/data-term/review', 'id' => $model->TERM_ID, 'cus_kd' => $model->CUST_KD_PARENT]);
        $options['tabindex'] = '-1';
        return '<li>' . Html::a($label, $url, $options) . '</li>' . PHP_EOL;
        // }
    }
}
 function canDelete(&$msg, $oid = null)
 {
     // TODO: check if user permissions are considered when deleting a project
     global $AppUI;
     return getPermission('projects', 'delete', $oid);
     // NOTE: I uncommented the dependencies check since it is
     // very anoying having to delete all tasks before being able
     // to delete a project.
     /*
     $tables[] = array('label' => 'Tasks', 'name' => 'tasks', 'idfield' => 'task_id', 
                       'joinfield' => 'task_project');
     // call the parent class method to assign the oid
     return CDpObject::canDelete($msg, $oid, $tables);
     */
 }
	</td>
	<td width="30%">
<?php 
        if (getPermission('companies', 'view', $row['project_company'])) {
            ?>
		<a href="?m=companies&amp;a=view&amp;company_id=<?php 
            echo $row['project_company'];
            ?>
" title="<?php 
            echo htmlspecialchars($row['company_description'], ENT_QUOTES);
            ?>
 ">
<?php 
        }
        echo htmlspecialchars($row['company_name'], ENT_QUOTES);
        if (getPermission('companies', 'view', $row['project_company'])) {
            ?>
		</a>
<?php 
        }
        ?>
	</td>
	<td width="100%">
		<a href="?m=projects&amp;a=view&amp;project_id=<?php 
        echo $row['project_id'];
        ?>
" onmouseover="return overlib('<?php 
        echo htmlspecialchars('<div><p>' . str_replace(array("\r\n", "\n", "\r"), '</p><p>', addslashes($row['project_description'])) . '</p></div>', ENT_QUOTES);
        ?>
', CAPTION, '<?php 
        echo $AppUI->_('Description');
示例#7
0
$task = new CTask();
$allowedProjects = $project->getAllowedSQL($AppUI->user_id, 'file_project');
$allowedTasks = $task->getAllowedSQL($AppUI->user_id, 'file_task');
$cfObj = new CFileFolder();
$allowedFolders = $cfObj->getAllowedSQL($AppUI->user_id, 'file_folder');
//get permissions for folder tab
$canAccess_folders = getPermission('file_folders', 'access');
// setup the title block
$titleBlock = new CTitleBlock('Files', 'folder5.png', $m, $m . '.' . $a);
$titleBlock->addCell($AppUI->_('Filter') . ':');
$titleBlock->addCell(arraySelect($projects, 'project_id', 'onchange="javascript:document.pickProject.submit()" size="1" class="text"', $project_id), '', '<form name="pickProject" action="?m=files" method="post">', '</form>');
/*
 * override the file module's $canEdit variable passed from the main index.php 
 * in order to check on file folder permissions
 */
$canAuthor_folders = getPermission('file_folders', 'add');
if ($canAuthor) {
    $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new file') . '" />', '', '<form action="?m=files&amp;a=addedit&amp;folder=' . $folder . '" method="post">', '</form>');
}
if ($canAuthor_folders) {
    $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new folder') . '" />', '', '<form action="?m=files&amp;a=addedit_folder" method="post">', '</form>');
}
$titleBlock->show();
$file_types = dPgetSysVal('FileType');
$fts = $file_types;
if ($tab != -1) {
    array_unshift($file_types, 'All Files');
}
$tabBox = new CTabBox('?m=files', DP_BASE_DIR . '/modules/files/', $tab);
$tabbed = $tabBox->isTabbed();
$i = 0;
示例#8
0
<?php

/* FORUMS $Id: view_pdf.php 6149 2012-01-09 11:58:40Z ajdonnison $ */
if (!defined('DP_BASE_DIR')) {
    die('You should not call this file directly.');
}
$AppUI->savePlace();
$sort = dPgetCleanParam($_REQUEST, 'sort', 'asc');
$forum_id = (int) dPgetParam($_REQUEST, 'forum_id', 0);
$message_id = (int) dPgetParam($_REQUEST, 'message_id', 0);
if (!getPermission('forums', 'view', $message_id)) {
    $AppUI->redirect("m=public&a=access_denied");
}
$q = new DBQuery();
$q->addTable('forums');
$q->addTable('forum_messages', 'msg');
$q->addQuery('msg.*, contact_first_name, contact_last_name, contact_email, user_username,
			forum_moderated, visit_user');
$q->addJoin('forum_visits', 'v', "visit_user = {$AppUI->user_id} AND visit_forum = {$forum_id} AND visit_message = msg.message_id");
$q->addJoin('users', 'u', 'message_author = u.user_id');
$q->addJoin('contacts', 'con', 'contact_id = user_contact');
$q->addWhere("forum_id = message_forum AND (message_id = {$message_id} OR message_parent = {$message_id})");
if (dPgetConfig('forum_descendent_order') || dPgetCleanParam($_REQUEST, 'sort', 0)) {
    $q->addOrder("message_date {$sort}");
}
$messages = $q->loadList();
$x = false;
$date = new CDate();
$pdfdata = array();
$pdfhead = array('Date', 'User', 'Message');
$new_messages = array();
示例#9
0
 function canUserEditTimeInformation()
 {
     global $AppUI;
     $project = new CProject();
     $project->load($this->task_project);
     // Code to see if the current user is
     // enabled to change time information related to task
     $can_edit_time_information = false;
     // Let's see if all users are able to edit task time information
     if (dPgetConfig('restrict_task_time_editing') == true && $this->task_id > 0) {
         // Am I the task owner?
         if ($this->task_owner == $AppUI->user_id) {
             $can_edit_time_information = true;
         }
         // Am I the project owner?
         if ($project->project_owner == $AppUI->user_id) {
             $can_edit_time_information = true;
         }
         // Am I sys admin?
         if (getPermission('admin', 'edit')) {
             $can_edit_time_information = true;
         }
     } else {
         if (dPgetConfig('restrict_task_time_editing') == false || $this->task_id == 0) {
             // If all users are able, then don't check anything
             $can_edit_time_information = true;
         }
     }
     return $can_edit_time_information;
 }
示例#10
0
function tombolReview($url, $model)
{
    if (getPermission()) {
        /* GF_ID>=4 Group Function[Director|GM|M|S] */
        $gF = getPermissionEmp()->GF_ID;
        $Auth2 = getPermission()->BTN_SIGN2;
        // Auth2
        $Auth3 = getPermission()->BTN_SIGN3;
        // Auth3
        $BtnReview = getPermission()->BTN_REVIEW;
        if (($Auth2 == 1 or $Auth3 == 1) and $gF <= 4 and $BtnReview = 1 or getPermissionEmp()->EMP_ID == $model->USER_CC) {
            $title = Yii::t('app', 'Review');
            $options = [];
            $icon = '<span class="glyphicon glyphicon-ok"></span>';
            $label = $icon . ' ' . $title;
            $url = Url::toRoute(['/purchasing/sales-order/review', 'kd' => $model->KD_RO]);
            //$url = Url::toRoute(['/purchasing/sales-order/approved']);
            //$url = Url::toRoute(['/purchasing/sales-order/approved']);
            $options['tabindex'] = '-1';
            return '<li>' . Html::a($label, $url, $options) . '</li>' . PHP_EOL;
        }
    }
}
示例#11
0
<?php

/* ADMIN $Id: do_userrole_aed.php 6149 2012-01-09 11:58:40Z ajdonnison $ */
if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
require_once $AppUI->getModuleClass('contacts');
$del = (bool) dPgetParam($_POST, 'del', false);
$role_id = (int) dPgetParam($_POST, 'role_id', 0);
$user_id = (int) dPgetParam($_POST, 'user_id', 0);
$user_role = (int) dPgetParam($_POST, 'user_role', 0);
if (!getPermission($m, 'edit', $user_id)) {
    $AppUI->redirect('m=public&a=access_denied');
}
// prepare (and translate) the module name ready for the suffix
$AppUI->setMsg('Role');
$perms =& $AppUI->acl();
if ($del) {
    if ($perms->deleteUserRole($role_id, $user_id)) {
        $AppUI->setMsg('deleted', UI_MSG_ALERT, true);
        if (dPgetConfig('user_contact_inactivate') && !$perms->checkLogin($user_id)) {
            // Mark contact as private
            $obj = new CUser();
            $contact = new CContact();
            $obj->load($user_id);
            if ($contact->load($obj->user_contact)) {
                $contact->contact_private = 1;
                $contact->store();
            }
        }
    } else {
示例#12
0
<?php

/* COMPANIES $Id: view.php 6080 2010-12-04 08:39:35Z ajdonnison $ */
if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
$company_id = intval(dPgetParam($_GET, 'company_id', 0));
// check permissions for this record
$canRead = getPermission($m, 'view', $company_id);
$canEdit = getPermission($m, 'edit', $company_id);
if (!$canRead) {
    $AppUI->redirect('m=public&a=access_denied');
}
// retrieve any state parameters
if (isset($_GET['tab'])) {
    $AppUI->setState('CompVwTab', $_GET['tab']);
}
$tab = $AppUI->getState('CompVwTab') !== NULL ? $AppUI->getState('CompVwTab') : 2;
// check if this record has dependencies to prevent deletion
$msg = '';
$obj = new CCompany();
$canDelete = $obj->canDelete($msg, $company_id);
// load the record data
$q = new DBQuery();
$q->addTable('companies', 'co');
$q->addQuery('co.*');
$q->addQuery('con.contact_first_name');
$q->addQuery('con.contact_last_name');
$q->addJoin('users', 'u', 'u.user_id = co.company_owner');
$q->addJoin('contacts', 'con', 'u.user_contact = con.contact_id');
$q->addWhere('co.company_id = ' . $company_id);
示例#13
0
<?php

/* PROJECTS $Id$ */
if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
/**
* Generates a report of the task logs for given dates
*/
if (!getPermission('task_log', 'view')) {
    redirect('m=public&a=access_denied');
}
$do_report = dPgetParam($_GET, "do_report", 0);
$log_all = dPgetParam($_GET, 'log_all', 0);
$log_pdf = dPgetParam($_GET, 'log_pdf', 0);
$log_ignore = dPgetParam($_GET, 'log_ignore', 0);
$log_userfilter = dPgetParam($_GET, 'log_userfilter', '0');
$log_start_date = dPgetParam($_GET, "log_start_date", 0);
$log_end_date = dPgetParam($_GET, "log_end_date", 0);
// create Date objects from the datetime fields
$start_date = intval($log_start_date) ? new CDate($log_start_date) : new CDate();
$end_date = intval($log_end_date) ? new CDate($log_end_date) : new CDate();
if (!$log_start_date) {
    $start_date->subtractSpan(new Date_Span("14,0,0,0"));
}
$end_date->setTime(23, 59, 59);
?>
<script language="javascript">
var calendarField = '';

function popCalendar(field) {
示例#14
0
<?php

/* PROJECTS $Id: reports.php 5874 2009-04-25 13:04:46Z merlinyoda $ */
if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
$project_id = intval(dPgetParam($_REQUEST, 'project_id', 0));
$report_type = dPgetParam($_REQUEST, 'report_type', '');
// check permissions for this record
$canRead = getPermission($m, 'view', $project_id);
if (!$canRead) {
    $AppUI->redirect('m=public&a=access_denied');
}
$project_list = array('0' => $AppUI->_('All', UI_OUTPUT_RAW));
$obj = new CProject();
$ptrc = $obj->getAllowedProjectsInRows($AppUI->user_id);
$nums = db_num_rows($ptrc);
echo db_error();
for ($x = 0; $x < $nums; $x++) {
    $row = db_fetch_assoc($ptrc);
    if ($row['project_id'] == $project_id) {
        $display_project_name = '(' . $row['project_short_name'] . ') ' . $row['project_name'];
    }
    $project_list[$row['project_id']] = '(' . $row['project_short_name'] . ') ' . $row['project_name'];
}
if (!$suppressHeaders) {
    ?>
<script language="javascript">
                                                                                
function changeIt() {
        var f=document.changeMe;
示例#15
0
function canDelete($mod, $item_id = 0)
{
    return getPermission($mod, 'delete', $item_id);
}
示例#16
0
" />
				<input type="text" class="text" name="start_date" id="date1" value="<?php 
echo $start_date->format($df);
?>
" class="text" disabled="disabled" />

				<a href="#" onClick="popCalendar('start_date', 'start_date');">
					<img src="./images/calendar.gif" width="24" height="12" alt="<?php 
echo $AppUI->_('Calendar');
?>
" border="0" />
				</a>
			</td>
			<td rowspan="6" valign="top">
					<?php 
if ($AppUI->isActiveModule('contacts') && getPermission('contacts', 'view')) {
    echo "<input type='button' class='button' value='" . $AppUI->_("Select contacts...") . "' onclick='javascript:popContacts();' />";
}
// Let's check if the actual company has departments registered
if ($department_selection_list != "") {
    ?>
								<br />
								<?php 
    echo $department_selection_list;
    ?>
							<?php 
}
?>
			</td>
		</tr>
		<tr>
示例#17
0
function tombolNewItem($kd, $status, $roHeader)
{
    if (getPermission()) {
        if (getPermission()->BTN_EDIT == 1 and $status == 0) {
            $title1 = Yii::t('app', 'New');
            $options1 = ['id' => 'add-new-item-id', 'data-toggle' => "modal", 'data-target' => "#add-new-item", 'class' => 'btn btn-warning btn-xs'];
            $icon1 = '<span class="fa fa-edit fa-xs"></span>';
            $label1 = $icon1 . ' ' . $title1;
            $url1 = Url::toRoute(['/purchasing/request-term/add-new-invest', 'kd' => $kd, 'term_id' => $roHeader->TERM_ID, 'cust_kd' => $roHeader->CUST_ID_PARENT]);
            $content = Html::a($label1, $url1, $options1);
            return $content;
        } else {
            $title1 = Yii::t('app', 'New');
            $options1 = ['id' => 'ro-tambah-detail', 'data-toggle' => "modal", 'data-target' => "#confirm-permission-alert", 'class' => 'btn btn-warning btn-xs'];
            $icon1 = '<span class="fa fa-plus fa-xs"></span>';
            $label1 = $icon1 . ' ' . $title1;
            $url1 = Url::toRoute(['#']);
            $content = Html::a($label1, $url1, $options1);
            return $content;
        }
    } else {
        $title1 = Yii::t('app', 'AddItem');
        $options1 = ['id' => 'ro-tambah-detail', 'data-toggle' => "modal", 'data-target' => "#confirm-permission-alert", 'class' => 'btn btn-warning btn-xs'];
        $icon1 = '<span class="fa fa-plus fa-xs"></span>';
        $label1 = $icon1 . ' ' . $title1;
        $url1 = Url::toRoute(['#']);
        $content = Html::a($label1, $url1, $options1);
        return $content;
    }
}
示例#18
0
require_once $AppUI->getModuleClass('companies');
$obj = new CCompany();
$companies = $obj->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name');
$filters2 = arrayMerge(array('all' => $AppUI->_('All Companies', UI_OUTPUT_RAW)), $companies);
// setup the title block
$titleBlock = new CTitleBlock('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 = dPformSafe($search_text);
$titleBlock->addCell('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $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') . '"/><!--<input type="submit" class="button" value=">" title="' . $AppUI->_('Search in name and description fields') . '"/>-->', '', '<form action="?m=tasks" method="post" id="searchfilter">', '</form>');
// Let's see if this user has admin privileges
if (getPermission('admin', 'view')) {
    $titleBlock->addCell();
    $titleBlock->addCell($AppUI->_('User') . ':');
    $q = new DBQuery();
    $q->addTable('users', 'u');
    $q->addTable('contacts', 'con');
    $q->addQuery('user_id');
    $q->addQuery("CONCAT(contact_last_name, ', ', contact_first_name, ' (', user_username, ')')" . ' AS label');
    $q->addOrder('contact_last_name');
    $q->addWhere('u.user_contact = con.contact_id');
    $user_list = $q->loadHashList();
    $titleBlock->addCell(arraySelect($user_list, 'user_id', 'size="1" class="text"' . ' onChange="document.userIdForm.submit();"', $user_id, false, true), '', '<form action="?m=tasks" method="post" name="userIdForm">', '</form>');
}
$titleBlock->addCell();
$titleBlock->addCell($AppUI->_('Company') . '/' . $AppUI->_('Department') . ':');
//get list of all departments, filtered by the list of permitted companies.
示例#19
0
<?php

/* SYSTEM $Id: viewmods.php 5585 2007-12-19 23:38:33Z merlinyoda $*/
if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
$AppUI->savePlace();
$canEdit = getPermission($m, 'edit');
$canRead = getPermission($m, 'view');
if (!$canRead) {
    $AppUI->redirect('m=public&a=access_denied');
}
$hidden_modules = array('public', 'install');
$q = new DBQuery();
$q->addQuery('*');
$q->addTable('modules');
foreach ($hidden_modules as $no_show) {
    $q->addWhere('mod_directory != \'' . $no_show . '\'');
}
$q->addOrder('mod_ui_order');
$modules = db_loadList($q->prepare());
// get the modules actually installed on the file system
$modFiles = $AppUI->readDirs('modules');
$titleBlock = new CTitleBlock('Modules', 'power-management.png', $m, $m . "." . $a);
$titleBlock->addCrumb('?m=system', 'System Admin');
$titleBlock->show();
?>

<table border="0" cellpadding="2" cellspacing="1" width="98%" class="tbl">
<tr>
	<th colspan="2"><?php 
示例#20
0
<?php

// check access to files module
if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly');
}
global $AppUI, $m, $obj, $task_id;
if (getPermission('links', 'view')) {
    if (getPermission('links', 'edit')) {
        echo '<a href="./index.php?m=links&a=addedit&project_id=' . $obj->task_project . '&link_task=' . $task_id . '">' . $AppUI->_('Attach a link') . '</a>';
    }
    echo dPshowImage(dPfindImage('stock_attach-16.png', $m), 16, 16, '');
    $showProject = false;
    $project_id = $obj->task_project;
    include DP_BASE_DIR . '/modules/links/index_table.php';
}
示例#21
0
// load the record data
$msg = '';
$row = new CContact();
$canDelete = $row->canDelete($msg, $contact_id);
// Don't allow to delete contacts, that have a user associated to them.
$q = new DBQuery();
$q->addTable('users');
$q->addQuery('user_id');
$q->addWhere('user_contact = ' . $contact_id);
$sql = $q->prepare();
$q->clear();
$tmp_user = db_loadResult($sql);
if (!empty($tmp_user)) {
    $canDelete = false;
}
$canEdit = getPermission($m, 'edit', $contact_id);
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) {
        $AppUI->redirect('m=public&a=access_denied');
    }
}
// setup the title block
$ttl = 'View Contact';
$titleBlock = new CTitleBlock($ttl, 'monkeychat-48.png', $m, "{$m}.{$a}");
$titleBlock->addCrumb('?m=contacts', 'contacts list');
if ($canEdit && $contact_id) {
    $titleBlock->addCrumb('?m=contacts&amp;a=addedit&amp;contact_id=' . $contact_id, 'edit');
示例#22
0
    }
    // end auto-translation code
    $s .= '</td>';
    $s .= "\n\t<td>";
    if ($canDelete) {
        $s .= "\n\t\t" . '<a href="javascript:delIt2(' . $row['task_log_id'] . ');" title="' . $AppUI->_('delete log') . '">' . "\n\t\t\t" . dPshowImage('./images/icons/stock_delete-16.png', 16, 16, '') . "\n\t\t</a>";
    }
    $s .= "\n\t</td>";
    $s .= '</tr>';
    $hrs += (double) $row['task_log_hours'];
}
$s .= '<tr bgcolor="white" valign="top">';
$s .= '<td colspan="6" align="right">' . $AppUI->_('Total Hours') . ' =</td>';
$s .= '<td align="right">' . sprintf("%.2f", $hrs) . '</td>';
$s .= '<td align="right" colspan="3"><form action="?m=tasks&a=view&tab=1&task_id=' . $task_id . '" method="post">';
if (getPermission('tasks', 'edit', $task_id)) {
    $s .= '<input type="submit" class="button" value="' . $AppUI->_('new log') . '"></form></td>';
}
$s .= '</tr>';
echo $s;
?>
</table>
<table>
<tr>
	<td><?php 
echo $AppUI->_('Key');
?>
:</td>
	<td>&nbsp; &nbsp;</td>
	<td bgcolor="#ffffff">&nbsp; &nbsp;</td>
	<td>=<?php 
示例#23
0
<?php

/* FORUMS $Id$ */
if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
// Add / Edit forum
$forum_id = intval(dPgetParam($_GET, 'forum_id', 0));
$forum_project = intval(dPgetParam($_GET, 'forum_project', 0));
// check permissions for this record
$canEdit = getPermission($m, 'edit', $forum_id);
if (!$canEdit || !$canAuthor) {
    $AppUI->redirect("m=public&a=access_denied");
}
// load the companies class to retrieved denied projects
require_once $AppUI->getModuleClass('projects');
$forum_id = intval(dPgetParam($_GET, 'forum_id', 0));
//Pull forum information
$q = new DBQuery();
$q->addTable('forums');
$q->addWhere("forums.forum_id = {$forum_id}");
$res = $q->exec();
echo db_error();
$forum_info = db_fetch_assoc($res);
$status = isset($forum_info["forum_status"]) ? $forum_info["forum_status"] : -1;
// get any project records denied from viewing
$projObj = new CProject();
//Pull project Information
$q = new DBQuery();
$q->addTable('projects');
$q->addQuery('project_id, project_name');
示例#24
0
<?php

/* $Id: index.php 6074 2010-11-25 23:38:38Z ajdonnison $ */
if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
if (!getPermission($m, 'view')) {
    $AppUI->redirect('m=public&a=access_denied');
}
if (!getPermission('users', 'view')) {
    $AppUI->redirect('m=public&a=access_denied');
}
$AppUI->savePlace();
if (isset($_GET['tab'])) {
    $AppUI->setState('UserIdxTab', $_GET['tab']);
}
$tab = $AppUI->getState('UserIdxTab') !== NULL ? $AppUI->getState('UserIdxTab') : 0;
if (isset($_GET['stub'])) {
    $AppUI->setState('UserIdxStub', $_GET['stub']);
    $AppUI->setState('UserIdxWhere', '');
} else {
    if (isset($_POST['where'])) {
        $AppUI->setState('UserIdxWhere', $_POST['where']);
        $AppUI->setState('UserIdxStub', '');
    }
}
$stub = $AppUI->getState('UserIdxStub');
$where = $AppUI->getState('UserIdxWhere');
$valid_ordering = array('user_username', 'contact_last_name', 'contact_company', 'date_time_in', 'user_ip');
if (isset($_GET['orderby']) && in_array($_GET['orderby'], $valid_ordering)) {
    $AppUI->setState('UserIdxOrderby', $_GET['orderby']);
示例#25
0
global $AppUI, $project_id, $task_id, $deny, $canRead, $canEdit, $dPconfig, $cfObj, $m, $obj;
require_once $AppUI->getModuleClass('files');
global $allowed_folders_ary, $denied_folders_ary, $limited;
$cfObj = new CFileFolder();
$allowed_folders_ary = $cfObj->getAllowedRecords($AppUI->user_id);
$denied_folders_ary = $cfObj->getDeniedRecords($AppUI->user_id);
$limited = count($allowed_folders_ary) < $cfObj->countFolders() ? true : false;
if (!$limited) {
    $canEdit = true;
} else {
    if ($limited && array_key_exists($folder, $allowed_folders_ary)) {
        $canEdit = true;
    } else {
        $canEdit = false;
    }
}
$showProject = false;
$project_id = $obj->task_project;
if (getPermission('files', 'edit')) {
    echo '<a href="?m=files&amp;a=addedit&amp;project_id=' . $project_id . '&amp;file_task=' . $task_id . '">' . $AppUI->_('Attach a file') . '</a>';
    echo dPshowImage(dPfindImage('stock_attach-16.png', $m), 16, 16, '');
}
$canAccess_folders = getPermission('file_folders', 'access');
if ($canAccess_folders) {
    $folder = (int) dPgetParam($_GET, 'folder', 0);
    require DP_BASE_DIR . '/modules/files/folders_table.php';
} else {
    if (getPermission('files', 'view')) {
        require DP_BASE_DIR . '/modules/files/index_table.php';
    }
}
示例#26
0
$obj = new CEvent();
$canDelete = $obj->canDelete($msg, $event_id);
// load the record data
if (!$obj->load($event_id)) {
    $AppUI->setMsg('Event');
    $AppUI->setMsg('invalidID', UI_MSG_ERROR, true);
    $AppUI->redirect();
} else {
    $AppUI->savePlace();
}
// load the event types
$types = dPgetSysVal('EventType');
// load the event recurs types
$recurs = array('Never', 'Hourly', 'Daily', 'Weekly', 'Bi-Weekly', 'Every Month', 'Quarterly', 'Every 6 months', 'Every Year');
$assigned = $obj->getAssigned();
if ($obj->event_owner != $AppUI->user_id && !getPermission('admin', 'view')) {
    $canEdit = false;
}
$df = $AppUI->getPref('SHDATEFORMAT');
$tf = $AppUI->getPref('TIMEFORMAT');
$start_date = $obj->event_start_date ? new CDate($obj->event_start_date) : null;
$end_date = $obj->event_end_date ? new CDate($obj->event_end_date) : null;
$event_project = db_LoadResult('SELECT project_name FROM projects where project_id=' . $obj->event_project);
// setup the title block
$titleBlock = new CTitleBlock('View Event', 'myevo-appointments.png', $m, "{$m}.{$a}");
if ($canAuthor) {
    $titleBlock->addCell();
    $titleBlock->addCell('<form action="?m=calendar&amp;a=addedit" method="post">' . '<input type="submit" class="button" value="' . $AppUI->_('new event') . '" /></form>', '', '', '');
}
$titleBlock->addCrumb('?m=calendar&amp;date=' . $start_date->format(FMT_TIMESTAMP_DATE), 'month view');
$titleBlock->addCrumb('?m=calendar&amp;a=day_view&amp;date=' . $start_date->format(FMT_TIMESTAMP_DATE) . '&amp;tab=0', 'day view');
示例#27
0
<?php

if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
// Copyright 2004 Adam Donnison <*****@*****.**>
$resource_id = intval(dPgetParam($_GET, 'resource_id', null));
$canDelete = getPermission('resources', 'delete', $resource_id);
$canView = getPermission('resources', 'view', $resource_id);
if (!$resource_id && !getPermission('resources', 'add') || !$canView || !$canEdit) {
    $AppUI->redirect('m=public&a=access_denied');
}
$obj = new CResource();
if ($resource_id && !$obj->load($resource_id)) {
    $AppUI->setMsg('Resource');
    $AppUI->setMsg('invalidID', UI_MSG_ERROR, true);
    $AppUI->redirect();
}
$titleBlock = new CTitleBlock($resource_id ? 'Edit Resource' : 'Add Resource', 'helpdesk.png', $m, "{$m}.{$a}");
$titleBlock->addCrumb('?m=resources', 'resource list');
if ($resource_id) {
    $titleBlock->addCrumb("?m=resources&amp;a=view&amp;resource_id={$resource_id}", 'view this resource');
}
$titleBlock->show();
$typelist = $obj->typeSelect();
?>
<form name="editfrm" action="?m=resources" method="post">
<input type="hidden" name="dosql" value="do_resource_aed" />
<input type="hidden" name="resource_id" value="<?php 
echo dPformSafe($resource_id);
?>
示例#28
0
        ?>
	</td>
	<td align="center" nowrap="nowrap" style="background-color:<?php 
        echo $priority[$row['project_priority']]['color'];
        ?>
">
		<?php 
        echo $end_date ? $end_date->format($df) : '-';
        ?>
	</td>
<?php 
        if ($editProjectsAllowed) {
            ?>
	<td align="center">
<?php 
            if (getPermission('projects', 'edit', $row['project_id'])) {
                ?>
		<input type="checkbox" name="project_id[]" value="<?php 
                echo $row['project_id'];
                ?>
" />
<?php 
            } else {
                ?>
		&nbsp;
<?php 
            }
            ?>
	</td>
<?php 
        }
示例#29
0
function tombolApproval($url, $model)
{
    if (getPermission()) {
        //Permission Jabatan
        $a = getPermissionEmployee()->JOBGRADE_ID;
        $b = getPermission()->BTN_SIGN1;
        //if(getPermissionEmployee()->JOBGRADE_ID == 'S' OR getPermissionEmployee()->JOBGRADE_ID == 'M' OR getPermissionEmployee()->JOBGRADE_ID == 'SM' AND getPermission()->BTN_SIGN1==1 ){
        if ($a == 'SEVP' or $a == 'EVP' or $a == 'SVP' or $a == 'VP' or $a == 'AVP' or $a == 'SM' or $a == 'M' or $a == 'AM' or $a == 'S' and $b == 1) {
            if ($model->STATUS == 0 || $model->STATUS == 1) {
                // 0=process 101=Approved
                $title = Yii::t('app', 'approved');
                $options = [];
                $icon = '<span class="glyphicon glyphicon-ok"></span>';
                $label = $icon . ' ' . $title;
                $url = Url::toRoute(['/purchasing/sales-order/approved', 'kd' => $model->KD_SA]);
                //$url = Url::toRoute(['/purchasing/sales-order/approved']);
                //$url = Url::toRoute(['/purchasing/sales-order/approved']);
                $options['tabindex'] = '-1';
                return '<li>' . Html::a($label, $url, $options) . '</li>' . PHP_EOL;
            }
        }
    }
}
示例#30
0
function displayFiles($folder_id)
{
    global $AppUI, $m, $a, $tab, $page;
    global $current_uri;
    global $canAccess, $canRead, $canEdit, $canAuthor, $canDelete;
    global $canAccess_folders, $canRead_folders, $canEdit_folders;
    global $canAuthor_folders, $canDelete_folders;
    global $company_id, $project_id, $task_id;
    global $allowedCompanies, $allowedProjects, $allowedTasks, $allowedFolders;
    global $showProject, $cfObj, $dPconfig;
    $df = $AppUI->getPref('SHDATEFORMAT');
    $tf = $AppUI->getPref('TIMEFORMAT');
    $file_types = dPgetSysVal('FileType');
    $xpg_pagesize = 30;
    //TODO?: Set by System Config Value ...
    $xpg_totalrecs = countFiles($folder_id);
    //get file count for folder
    $xpg_total_pages = $xpg_totalrecs > $xpg_pagesize ? ceil($xpg_totalrecs / $xpg_pagesize) : 1;
    $xpg_min = $xpg_pagesize * ($page - 1);
    // This is where we start our record set from
    $q = new DBQuery();
    // most recent version info per file_project and file_version_id
    $q->createTemp('files_count_max' . $folder_id);
    $q->addTable('files', 'f');
    $q->addQuery('DISTINCT count(f.file_id) as file_versions' . ', max(f.file_version) as file_lastversion' . ', file_version_id, f.file_project');
    $q->addJoin('projects', 'p', 'p.project_id = f.file_project');
    $q->addJoin('tasks', 't', 't.task_id = f.file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
    $q->addWhere('f.file_folder = ' . $folder_id);
    if (count($allowedProjects)) {
        $q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
    }
    if (count($allowedTasks)) {
        $q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)');
    }
    if (count($allowedFolders)) {
        $q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)');
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('co.company_id = ' . $company_id);
        if (count($allowedCompanies)) {
            $q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')');
        }
    }
    $q->addGroup('f.file_version_id');
    $q->addGroup('f.file_project');
    $file_version_max_counts = $q->exec();
    $q->clear();
    // most recent version
    $q->addTable('files', 'f');
    $q->addQuery('f.*, fmc.file_versions, round(fmc.file_lastversion, 2) as file_lastversion' . ', u.user_username as file_owner, ff.file_folder_name' . ', ff.file_folder_id, ff.file_folder_name, p.project_name' . ', p.project_color_identifier, p.project_owner, c.contact_first_name' . ', c.contact_last_name, t.task_name, u.user_username as file_owner' . ', cc.contact_first_name as checkout_first_name' . ', cc.contact_last_name as checkout_last_name');
    $q->addJoin('files_count_max' . $folder_id, 'fmc', '(fmc.file_lastversion=f.file_version AND fmc.file_version_id=f.file_version_id' . ' AND fmc.file_project=f.file_project)', 'inner');
    $q->addJoin('projects', 'p', 'p.project_id = f.file_project');
    $q->addJoin('users', 'u', 'u.user_id = f.file_owner');
    $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact');
    $q->addJoin('tasks', 't', 't.task_id = f.file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
    $q->leftJoin('users', 'cu', 'cu.user_id = f.file_checkout');
    $q->leftJoin('contacts', 'cc', 'cc.contact_id = cu.user_contact');
    $q->addWhere('f.file_folder = ' . $folder_id);
    if (count($allowedProjects)) {
        $q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
    }
    if (count($allowedTasks)) {
        $q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)');
    }
    if (count($allowedFolders)) {
        $q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)');
    }
    if ($project_id) {
        $q->addWhere('f.file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('f.file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('co.company_id = ' . $company_id);
        if (count($allowedCompanies)) {
            $q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')');
        }
    }
    $q->addOrder('p.project_name');
    $q->setLimit($xpg_pagesize, $xpg_min);
    $files_sql = $q->prepare();
    $q->clear();
    // all versions
    $q->addTable('files', 'f');
    $q->addQuery('f.*, ff.file_folder_id, ff.file_folder_name, p.project_name' . ', p.project_color_identifier, p.project_owner, c.contact_first_name' . ', c.contact_last_name, t.task_name, u.user_username as file_owner');
    $q->addJoin('projects', 'p', 'p.project_id = f.file_project');
    $q->addJoin('users', 'u', 'u.user_id = f.file_owner');
    $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact');
    $q->addJoin('tasks', 't', 't.task_id = f.file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
    $q->addWhere('f.file_folder = ' . $folder_id);
    if (count($allowedProjects)) {
        $q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
    }
    if (count($allowedTasks)) {
        $q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)');
    }
    if (count($allowedFolders)) {
        $q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)');
    }
    if ($project_id) {
        $q->addWhere('f.file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('f.file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('co.company_id = ' . $company_id);
        if (count($allowedCompanies)) {
            $q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')');
        }
    }
    $file_versions_sql = $q->prepare();
    $q->clear();
    //file arrays
    $files = array();
    $file_versions = array();
    if ($canRead) {
        $files = db_loadList($files_sql);
        $file_versions = db_loadHashList($file_versions_sql, 'file_id');
    }
    $q->dropTemp('files_count_max' . $folder_id);
    $q->exec();
    if ($files == array()) {
        return;
    }
    ?>
	<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
	<tr>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('File Name');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Description');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Versions');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Category');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Task Name');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Owner');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Size');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Date');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('co Reason');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('co');
    ?>
</th>
		<th nowrap width="1"></th>
		<th nowrap width="1"></th>
	</tr>
<?php 
    $fp = -1;
    $file_date = new CDate();
    $id = 0;
    foreach ($files as $row) {
        $file_date = new CDate($row['file_date']);
        $canEdit_file = getPermission('files', 'edit', $row['file_id']);
        //single file
        if ($fp != $row['file_project']) {
            if (!$row['file_project']) {
                $row['project_name'] = $AppUI->_('Not associated to projects');
                $row['project_color_identifier'] = 'f4efe3';
            }
            if ($showProject) {
                $style = 'background-color:#' . $row['project_color_identifier'] . ';color:' . bestColor($row['project_color_identifier']);
                ?>
<tr>
	<td colspan="20" style="border: outset 2px #eeeeee;<?php 
                echo $style;
                ?>
">
	<a href="?m=projects&a=view&project_id=<?php 
                echo $row['file_project'];
                ?>
">
	<span style="<?php 
                echo $style;
                ?>
"><?php 
                echo $row['project_name'];
                ?>
</span></a>
	</td>
</tr>
<?php 
            }
        }
        $fp = $row['file_project'];
        ?>
	<form name="frm_remove_file_<?php 
        echo $row['file_id'];
        ?>
" action="?m=files" 
	 method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="del" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $row['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<form name="frm_duplicate_file_<?php 
        echo $row['file_id'];
        ?>
" action="?m=files" 
	 method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="duplicate" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $row['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<tr>
		<td nowrap="8%">
<?php 
        $file_icon = getIcon($row['file_type']);
        ?>
		  <a href="./fileviewer.php?file_id=<?php 
        echo $row['file_id'];
        ?>
" 
		   title="<?php 
        echo $row['file_description'];
        ?>
"> 
		  <?php 
        echo dPshowImage(DP_BASE_URL . '/modules/files/images/' . $file_icon, '16', '16');
        ?>
		  &nbsp;<?php 
        echo $row['file_name'];
        ?>
 
		  </a>
		</td>
		<td width="20%"><?php 
        echo $row['file_description'];
        ?>
</td>
		<td width="5%" nowrap="nowrap" align="center">
<?php 
        $hidden_table = '';
        echo $row['file_lastversion'];
        if ($row['file_versions'] > 1) {
            ?>
	  <a href="#" onClick="expand('versions_<?php 
            echo $row['file_id'];
            ?>
');">
	  (<?php 
            echo $row['file_versions'];
            ?>
)
	  </a>
<?php 
        }
        ?>
		</td>
		<td width="10%" nowrap="nowrap" align="center">
		  <?php 
        echo $file_types[$row['file_category']];
        ?>
		</td>
		<td width="5%" align="center">
		  <a href="./index.php?m=tasks&a=view&task_id=<?php 
        echo $row['file_task'];
        ?>
">
		  <?php 
        echo $row['task_name'];
        ?>
		  </a>
		</td>
		<td width="15%" nowrap="nowrap">
		  <?php 
        echo $row["contact_first_name"] . ' ' . $row["contact_last_name"];
        ?>
		</td>
		<td width="5%" nowrap="nowrap" align="right">
		  <?php 
        echo file_size(intval($row['file_size']));
        ?>
		</td>
		<td width="15%" nowrap="nowrap" align="right">
		  <?php 
        echo $file_date->format($df . ' ' . $tf);
        ?>
		</td>
		<td width="10%"><?php 
        echo $row['file_co_reason'];
        ?>
</td>
		<td nowrap="nowrap" align="center">
		  
<?php 
        if ($canEdit && empty($row['file_checkout'])) {
            ?>
			  <a href="?m=files&a=co&file_id=<?php 
            echo $row['file_id'];
            ?>
">
			  <?php 
            echo dPshowImage(DP_BASE_URL . '/modules/files/images/up.png', '16', '16', 'checkout', 'checkout file');
            ?>
			  </a>
<?php 
        } else {
            if ($row['file_checkout'] == $AppUI->user_id) {
                ?>
			  <a href="?m=files&a=addedit&ci=1&file_id=<?php 
                echo $row['file_id'];
                ?>
">
			  <?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/down.png', '16', '16', 'checkin', 'checkin file');
                ?>
			  </a>
<?php 
            } else {
                if ($file['file_checkout'] == 'final') {
                    echo '			  ' . $AppUI->_('final');
                } else {
                    echo '	  ' . $row['checkout_first_name'] . ' ' . $row['checkout_last_name'] . '<br />(' . $row['co_user'] . ')';
                }
            }
        }
        ?>
		</td>
		<td nowrap="nowrap" align="right" width="48">
		  <?php 
        if (empty($row['file_checkout']) || $row['file_checkout'] == 'final') {
            // Edit File
            if ($canEdit || $row['project_owner'] == $AppUI->user_id) {
                ?>
		  <a href="./index.php?m=files&a=addedit&file_id=<?php 
                echo $row['file_id'];
                ?>
">
<?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file');
                ?>
		  </a>
<?php 
            }
            // Duplicate File
            if ($canAuthor || $row['project_owner'] == $AppUI->user_id) {
                ?>
		  <a href="#" 
		   onclick="document.frm_duplicate_file_<?php 
                echo $row['file_id'];
                ?>
.submit()">
<?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file');
                ?>
		  </a>
<?php 
            }
            // Delete File
            if ($canDelete || $row['project_owner'] == $AppUI->user_id) {
                ?>
		  <a href="#" 
		   onclick="if (confirm('Are you sure you want to delete this file?')) {document.frm_remove_file_<?php 
                echo $row['file_id'];
                ?>
.submit()}">
<?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/remove.png', '16', '16', 'delete file', 'delete file');
                ?>
		  </a>
<?php 
            }
        }
        ?>
		</td>
		<td nowrap="nowrap" align="center" width="1">
<?php 
        if ((empty($row['file_checkout']) || $row['file_checkout'] == 'final') && ($canEdit || $row['project_owner'] == $AppUI->user_id)) {
            $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $row['file_id'] . ') : removeBulkComponent(' . $row['file_id'] . ')"';
            ?>
			<input type="checkbox" <?php 
            echo $bulk_op;
            ?>
 
			 name="chk_sub_sel_file_<?php 
            echo $file_row['file_id'];
            ?>
" />
<?php 
        }
        ?>
		</td>
</tr>



<?php 
        if ($row['file_versions'] > 1) {
            ?>

	  <tr><td colspan="20">
		<table style="display: none" id="versions_<?php 
            echo $row['file_id'];
            ?>
" 
		 width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
		  <tr>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('File Name');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Description');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Versions');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Category');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Task Name');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Owner');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Size');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Type');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Date');
            ?>
</th>
			<th nowrap="nowrap"width="1">&nbsp;</th>
			<th nowrap="nowrap"width="1">&nbsp;</th>
		  </tr>
<?php 
            foreach ($file_versions as $file) {
                if ($file['file_version_id'] == $row['file_version_id']) {
                    $file_icon = getIcon($file['file_type']);
                    $file_version_date = new Date($file['file_date']);
                    ?>

		  <form name="frm_delete_sub_file_<?php 
                    echo $file['file_id'];
                    ?>
" 
		   action="?m=files" method="post">
		  <input type="hidden" name="dosql" value="do_file_aed" />
		  <input type="hidden" name="del" value="1" />
		  <input type="hidden" name="file_id" value="<?php 
                    echo $file['file_id'];
                    ?>
" />
		  <input type="hidden" name="redirect" value="<?php 
                    echo $current_uri;
                    ?>
" />
		  </form>		
		  <form name="frm_duplicate_sub_file_<?php 
                    echo $file['file_id'];
                    ?>
" 
		   action="?m=files" method="post">
		  <input type="hidden" name="dosql" value="do_file_aed" />
		  <input type="hidden" name="duplicate" value="1" />
		  <input type="hidden" name="file_id" value="<?php 
                    echo $file['file_id'];
                    ?>
" />
		  <input type="hidden" name="redirect" value="<?php 
                    echo $current_uri;
                    ?>
" />
		  </form>
		  <tr>
			<td nowrap="8%">
			  <a href="./fileviewer.php?file_id=<?php 
                    echo $file['file_id'];
                    ?>
" 
			   title="<?php 
                    echo $file['file_description'];
                    ?>
">
			  <?php 
                    echo dPshowImage(DP_BASE_URL . '/modules/files/images/' . $file_icon, '16', '16');
                    ?>
			  <?php 
                    echo $file['file_name'];
                    ?>
 
			  </a>
			</td>
			<td width="20%"><?php 
                    echo $file['file_description'];
                    ?>
</td>
			<td width="5%" nowrap="nowrap" align="center"><?php 
                    echo $file['file_version'];
                    ?>
</td>
			<td width="10%" nowrap="nowrap" align="center">
			  <?php 
                    echo $file_types[$file['file_category']];
                    ?>
			</td>
			<td width="5%" align="center">
			  <a href="./index.php?m=tasks&a=view&task_id=<?php 
                    echo $file['file_task'];
                    ?>
">
			  <?php 
                    echo $file['task_name'];
                    ?>
			  </a>
			</td>
			<td width="15%" nowrap="nowrap">
			  <?php 
                    echo $file["contact_first_name"] . ' ' . $file["contact_last_name"];
                    ?>
			</td>
			<td width="5%" nowrap="nowrap" align="right">
			  <?php 
                    echo file_size(intval($file['file_size']));
                    ?>
			</td>
			<td nowrap="nowrap">
			  <?php 
                    echo $row['file_type'];
                    ?>
			</td>
			<td width="15%" nowrap="nowrap" align="right">
			  <?php 
                    echo $file_version_date->format($df . ' ' . $tf);
                    ?>
			</td>
			
			<td nowrap="nowrap" align="right" width="48">
			  <?php 
                    if (empty($file['file_checkout']) || $file['file_checkout'] == 'final') {
                        // Edit File
                        if ($canEdit || $row['project_owner'] == $AppUI->user_id) {
                            ?>
			  <a href="./index.php?m=files&a=addedit&file_id=<?php 
                            echo $row['file_id'];
                            ?>
">
<?php 
                            echo dPshowImage(DP_BASE_URL . '/modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file');
                            ?>
			  </a>
<?php 
                        }
                        // Duplicate File
                        if ($canAuthor) {
                            ?>
			  <a href="#" 
			   onclick="document.frm_duplicate_file_<?php 
                            echo $row['file_id'];
                            ?>
.submit()">
<?php 
                            echo dPshowImage(DP_BASE_URL . '/modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file');
                            ?>
			  </a>
<?php 
                        }
                        // Delete File
                        if ($canDelete) {
                            ?>
			  <a href="#" 
			   onclick="if (confirm('<?php 
                            echo $AppUI->_('Are you sure you want to delete this file?');
                            ?>
')) {document.frm_remove_file_<?php 
                            echo $row['file_id'];
                            ?>
.submit()}">
<?php 
                            echo dPshowImage(DP_BASE_URL . '/modules/files/images/remove.png', '16', '16', 'delete file', $AppUI->_('delete file'));
                            ?>
			  </a>
<?php 
                        }
                    }
                    ?>
			</td>
			<td nowrap="nowrap" align="center" width="1">
<?php 
                    if ((empty($row['file_checkout']) || $row['file_checkout'] == 'final') && ($canEdit || $row['project_owner'] == $AppUI->user_id)) {
                        $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $row['file_id'] . ') : removeBulkComponent(' . $row['file_id'] . ')"';
                        ?>
			  <input type="checkbox" <?php 
                        echo $bulk_op;
                        ?>
 
			   name="chk_sub_sel_file_<?php 
                        echo $file_row['file_id'];
                        ?>
" />
<?php 
                    }
                    ?>
			  </td>
			</tr>
<?php 
                }
            }
            ?>
		</table>
	  </td></tr>
<?php 
        }
    }
    ?>

	</table>
	<?php 
    shownavbar($xpg_totalrecs, $xpg_pagesize, $xpg_total_pages, $page, $folder_id);
    echo "<br />";
}