コード例 #1
0
ファイル: picmgr.php プロジェクト: phill104/branches
function albumselect($id = "album")
{
    // frogfoot re-wrote this function to present the list in categorized, sorted and nicely formatted order
    global $CONFIG, $lang_picmgr_php, $aid, $lang_errors, $cpg_udb;
    static $select = "";
    // Reset counter
    $list_count = 0;
    if ($select == "") {
        // albums in root category
        if (GALLERY_ADMIN_MODE) {
            $result = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = 0");
            while ($row = mysql_fetch_array($result)) {
                // Add to multi-dim array for later sorting
                $listArray[$list_count]['cat'] = $lang_search_new_php['albums_no_category'];
                $listArray[$list_count]['aid'] = $row['aid'];
                $listArray[$list_count]['title'] = $row['title'];
                $list_count++;
            }
            mysql_free_result($result);
        }
        // albums in public categories
        if (GALLERY_ADMIN_MODE) {
            $result = cpg_db_query("SELECT DISTINCT a.aid AS aid, a.title AS title, c.name AS cname FROM {$CONFIG['TABLE_ALBUMS']} AS a, {$CONFIG['TABLE_CATEGORIES']} AS c WHERE a.category = c.cid AND a.category < '" . FIRST_USER_CAT . "'");
            while ($row = mysql_fetch_array($result)) {
                // Add to multi-dim array for later sorting
                $listArray[$list_count]['cat'] = $row['cname'];
                $listArray[$list_count]['aid'] = $row['aid'];
                $listArray[$list_count]['title'] = $row['title'];
                $list_count++;
            }
            mysql_free_result($result);
        }
        // albums in user's personal galleries
        //        if (defined('UDB_INTEGRATION')) {
        //if (GALLERY_ADMIN_MODE) {
        //                $sql = $cpg_udb->get_admin_album_list();
        /*} else {
              $sql = "SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = ".(FIRST_USER_CAT + USER_ID);
          }*/
        //       } else {
        if (GALLERY_ADMIN_MODE) {
            //                $sql = "SELECT aid, CONCAT('(', user_name, ') ', title) AS title " . "FROM {$CONFIG['TABLE_ALBUMS']} AS a " . "INNER JOIN {$CONFIG['TABLE_USERS']} AS u ON category = (" . FIRST_USER_CAT . " + user_id)";
            $sql = $cpg_udb->get_admin_album_list();
            //it's always bridged so we no longer need to check.
        } else {
            $sql = "SELECT aid, title AS title FROM {$CONFIG['TABLE_ALBUMS']}  WHERE category = " . (FIRST_USER_CAT + USER_ID);
        }
        //       }
        $result = cpg_db_query($sql);
        while ($row = mysql_fetch_array($result)) {
            // Add to multi-dim array for later sorting
            $listArray[$list_count]['cat'] = $lang_search_new_php['personal_albums'];
            $listArray[$list_count]['aid'] = $row['aid'];
            $listArray[$list_count]['title'] = $row['title'];
            $list_count++;
        }
        mysql_free_result($result);
        if (!$aid) {
            $select = '<option value="0">' . $lang_picmgr_php['no_album'] . "</option>\n";
        }
        // Sort the pulldown options by category and album name
        $listArray = array_csort($listArray, 'cat', 'title');
        // Create the nicely sorted and formatted drop down list
        $alb_cat = '';
        foreach ($listArray as $val) {
            if ($val['cat'] != $alb_cat) {
                if ($alb_cat) {
                    $select .= "</optgroup>\n";
                }
                $select .= '<optgroup label="' . $val['cat'] . '">' . "\n";
                $alb_cat = $val['cat'];
            }
            $select .= '<option value="' . $val['aid'] . '"' . ($val['aid'] == $aid ? ' selected="selected"' : '') . '>   ' . $val['title'] . "</option>\n";
        }
        if ($alb_cat) {
            $select .= "</optgroup>\n";
        }
    }
    return "\n<select name=\"{$id}\" class=\"listbox\"  onChange=\"if(this.options[this.selectedIndex].value) window.location.href='{$_SERVER['PHP_SELF']}?aid='+this.options[this.selectedIndex].value;\" >\n{$select}</select>\n";
}
コード例 #2
0
ファイル: rivals.php プロジェクト: Heart1010/JoomLeague
 function getOpponents()
 {
     $query = ' SELECT m.id ';
     $query .= ' , m.projectteam1_id ';
     $query .= ' , m.projectteam2_id ';
     $query .= ' , pt1.project_id ';
     $query .= ' , pt1.team_id AS team1_id ';
     $query .= ' , pt2.team_id AS team2_id ';
     $query .= ' , pt1.division_id AS division_id ';
     $query .= ' , m.team1_result ';
     $query .= ' , m.team2_result ';
     $query .= ' , m.alt_decision ';
     $query .= ' , m.team1_result_decision ';
     $query .= ' , m.team2_result_decision ';
     $query .= ' , t1.short_name AS short_name1 ';
     $query .= ' , t2.short_name AS short_name2 ';
     $query .= ' , t1.middle_name AS middle_name1 ';
     $query .= ' , t2.middle_name AS middle_name2 ';
     $query .= ' , t1.name AS name1 ';
     $query .= ' , t2.name AS name2 ';
     $query .= ' , t1.club_id AS club1_id ';
     $query .= ' , t2.club_id AS club2_id ';
     $query .= ' FROM #__joomleague_match AS m ';
     $query .= ' INNER JOIN #__joomleague_project_team AS pt1 ON pt1.id = m.projectteam1_id ';
     $query .= ' INNER JOIN #__joomleague_project_team AS pt2 ON pt2.id = m.projectteam2_id ';
     $query .= ' JOIN #__joomleague_team AS t1 ON pt1.team_id=t1.id ';
     $query .= ' JOIN #__joomleague_team AS t2 ON pt2.team_id=t2.id ';
     $query .= ' WHERE m.published = 1 ';
     $query .= ' AND (pt1.team_id = ' . $this->_db->Quote($this->teamid);
     $query .= ' OR pt2.team_id = ' . $this->_db->Quote($this->teamid) . ')';
     $query .= ' AND (m.team1_result IS NOT NULL OR m.alt_decision > 0)';
     $query .= ' AND (m.cancel IS NULL OR m.cancel = 0) ';
     $query .= ' ORDER BY m.id ';
     $query .= ';';
     $this->_db->setQuery($query);
     $matches = $this->_db->loadObjectList();
     $opo = array();
     foreach ($matches as $match) {
         if (!isset($opo[$match->team2_id])) {
             $opo[$match->team2_id] = array('match' => 0, 'name' => '', 'g_for' => 0, 'g_aga' => 0, 'win' => 0, 'tie' => 0, 'los' => 0);
         }
         if (!isset($opo[$match->team1_id])) {
             $opo[$match->team1_id] = array('match' => 0, 'name' => '', 'g_for' => 0, 'g_aga' => 0, 'win' => 0, 'tie' => 0, 'los' => 0);
         }
         if ($match->team1_id == $this->teamid) {
             $opo[$match->team2_id]['projectteamid'] = $match->projectteam2_id;
             $opo[$match->team2_id]['project_id'] = $match->project_id;
             $opo[$match->team2_id]['division_id'] = $match->division_id;
             $opo[$match->team2_id]['match'] += 1;
             $opo[$match->team2_id]['id'] = $match->team2_id;
             $opo[$match->team2_id]['team_id'] = $match->team2_id;
             $opo[$match->team2_id]['club_id'] = $match->club2_id;
             $opo[$match->team2_id]['name'] = $match->name2;
             $opo[$match->team2_id]['short_name'] = $match->short_name2;
             $opo[$match->team2_id]['middle_name'] = $match->middle_name2;
             $opo[$match->team2_id]['g_for'] += $match->team1_result;
             $opo[$match->team2_id]['g_aga'] += $match->team2_result;
             if (!$match->alt_decision) {
                 if ($match->team1_result > $match->team2_result) {
                     $opo[$match->team2_id]['win'] += 1;
                 } else {
                     if ($match->team1_result < $match->team2_result) {
                         $opo[$match->team2_id]['los'] += 1;
                     } else {
                         $opo[$match->team2_id]['tie'] += 1;
                     }
                 }
             } else {
                 if (empty($match->team1_result_decision)) {
                     $opo[$match->team2_id]['forfeit'] += 1;
                 } else {
                     if ($match->team1_result_decision > $match->team2_result_decision) {
                         $opo[$match->team2_id]['win'] += 1;
                     } else {
                         if ($match->team1_result_decision < $match->team2_result_decision) {
                             $opo[$match->team2_id]['los'] += 1;
                         } else {
                             $opo[$match->team2_id]['tie'] += 1;
                         }
                     }
                 }
             }
         } else {
             $opo[$match->team1_id]['match'] += 1;
             $opo[$match->team1_id]['name'] = $match->name1;
             $opo[$match->team1_id]['g_for'] += $match->team2_result;
             $opo[$match->team1_id]['g_aga'] += $match->team1_result;
             if (!$match->alt_decision) {
                 if ($match->team1_result > $match->team2_result) {
                     $opo[$match->team1_id]['los'] += 1;
                 } else {
                     if ($match->team1_result < $match->team2_result) {
                         $opo[$match->team1_id]['win'] += 1;
                     } else {
                         $opo[$match->team1_id]['tie'] += 1;
                     }
                 }
             } else {
                 if (empty($match->team2_result_decision)) {
                     $opo[$match->team1_id]['forfeit'] += 1;
                 } else {
                     if ($match->team1_result_decision > $match->team2_result_decision) {
                         $opo[$match->team1_id]['los'] += 1;
                     } else {
                         if ($match->team1_result_decision < $match->team2_result_decision) {
                             $opo[$match->team1_id]['win'] += 1;
                         } else {
                             $opo[$match->team1_id]['tie'] += 1;
                         }
                     }
                 }
             }
         }
     }
     function array_csort()
     {
         $i = 0;
         $args = func_get_args();
         $marray = array_shift($args);
         $msortline = 'return(array_multisort(';
         foreach ($args as $arg) {
             $i++;
             if (is_string($arg)) {
                 foreach ($marray as $row) {
                     $sortarr[$i][] = $row[$arg];
                 }
             } else {
                 $sortarr[$i] = $arg;
             }
             $msortline .= '$sortarr[' . $i . '],';
         }
         $msortline .= '$marray));';
         eval($msortline);
         return $marray;
     }
     $sorted = array();
     if (count($opo)) {
         $sorted = array_csort($opo, 'match', SORT_DESC, 'win', SORT_DESC, 'g_for', SORT_DESC);
     }
     return $sorted;
 }
コード例 #3
0
ファイル: tasks.php プロジェクト: eureka2/web2project
												</select>
											</td>
									  </tr>
								  </table>
							  </td>
								<?php 
            }
            ?>
					</tr>
					<?php 
        }
        if ($task_sort_item1 != '') {
            if ($task_sort_item2 != '' && $task_sort_item1 != $task_sort_item2) {
                $p['tasks'] = array_csort($p['tasks'], $task_sort_item1, $task_sort_order1, $task_sort_type1, $task_sort_item2, $task_sort_order2, $task_sort_type2);
            } else {
                $p['tasks'] = array_csort($p['tasks'], $task_sort_item1, $task_sort_order1, $task_sort_type1);
            }
        }
        global $tasks_filtered, $children_of;
        //get list of task ids and set-up array of children
        if (isset($p['tasks']) && is_array($p['tasks'])) {
            foreach ($p['tasks'] as $i => $t) {
                $tasks_filtered[] = $t['task_id'];
                $children_of[$t['task_parent']] = isset($t['task_parent']) && isset($children_of[$t['task_parent']]) && $children_of[$t['task_parent']] ? $children_of[$t['task_parent']] : array();
                if ($t['task_parent'] != $t['task_id']) {
                    array_push($children_of[$t['task_parent']], $t['task_id']);
                }
            }
            global $shown_tasks;
            $shown_tasks = array();
            $parent_tasks = array();
コード例 #4
0
ファイル: mod_lang.php プロジェクト: phill104/branches
/**
 * Function to create the album drop down.
 */
function albumselect($id = "album")
{
    global $CONFIG, $lang_picmgr_php, $lang_errors, $cpg_udb;
    //static $select = "";
    if (isset($_REQUEST['album']) && $id == "album") {
        $aid = $_REQUEST['album'];
    } elseif (isset($_REQUEST['picAlbum']) && $id == "picAlbum") {
        $aid = $_REQUEST['picAlbum'];
    }
    // Reset counter
    $list_count = 0;
    if ($select == "") {
        // albums in root category
        if (GALLERY_ADMIN_MODE) {
            $result = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = 0");
            while ($row = mysql_fetch_array($result)) {
                // Add to multi-dim array for later sorting
                $listArray[$list_count]['cat'] = $lang_search_new_php['albums_no_category'];
                $listArray[$list_count]['aid'] = $row['aid'];
                $listArray[$list_count]['title'] = $row['title'];
                $list_count++;
            }
            mysql_free_result($result);
        }
        // albums in public categories
        if (GALLERY_ADMIN_MODE) {
            $result = cpg_db_query("SELECT DISTINCT a.aid AS aid, a.title AS title, c.name AS cname FROM {$CONFIG['TABLE_ALBUMS']} AS a, {$CONFIG['TABLE_CATEGORIES']} AS c WHERE a.category = c.cid AND a.category < '" . FIRST_USER_CAT . "'");
            while ($row = mysql_fetch_array($result)) {
                // Add to multi-dim array for later sorting
                $listArray[$list_count]['cat'] = $row['cname'];
                $listArray[$list_count]['aid'] = $row['aid'];
                $listArray[$list_count]['title'] = $row['title'];
                $list_count++;
            }
            mysql_free_result($result);
        }
        if (GALLERY_ADMIN_MODE) {
            $sql = $cpg_udb->get_admin_album_list();
            //it's always bridged so we no longer need to check.
        } else {
            $sql = "SELECT aid, title AS title FROM {$CONFIG['TABLE_ALBUMS']}  WHERE category = " . (FIRST_USER_CAT + USER_ID);
        }
        $result = cpg_db_query($sql);
        while ($row = mysql_fetch_array($result)) {
            // Add to multi-dim array for later sorting
            $listArray[$list_count]['cat'] = $lang_search_new_php['personal_albums'];
            $listArray[$list_count]['aid'] = $row['aid'];
            $listArray[$list_count]['title'] = $row['title'];
            $list_count++;
        }
        mysql_free_result($result);
        $select = "<option value=\"0\">Select album</option>\n";
        // Sort the pulldown options by category and album name
        $listArray = array_csort($listArray, 'cat', 'title');
        // Create the nicely sorted and formatted drop down list
        $alb_cat = '';
        foreach ($listArray as $val) {
            if ($val['cat'] != $alb_cat) {
                if ($alb_cat) {
                    $select .= "</optgroup>\n";
                }
                $select .= '<optgroup label="' . $val['cat'] . '">' . "\n";
                $alb_cat = $val['cat'];
            }
            $select .= '<option value="' . $val['aid'] . '"' . ($val['aid'] == $aid ? ' selected="selected"' : '') . '>   ' . $val['title'] . "</option>\n";
        }
        if ($alb_cat) {
            $select .= "</optgroup>\n";
        }
    }
    return "\n<select name=\"{$id}\" class=\"listbox\"  onChange=\"this.form.submit();\" >\n{$select}</select>\n";
}
コード例 #5
0
ファイル: Popup_picker.php プロジェクト: rgauss/sugarcrm_dev
 /**
  *
  */
 function process_page()
 {
     global $focus;
     global $mod_strings;
     global $app_strings;
     global $app_list_strings;
     global $currentModule;
     global $odd_bg;
     global $even_bg;
     global $timedate;
     $history_list = array();
     if (!empty($_REQUEST['record'])) {
         $result = $focus->retrieve($_REQUEST['record']);
         if ($result == null) {
             sugar_die($app_strings['ERROR_NO_RECORD']);
         }
     }
     $activitiesRels = array('tasks' => 'Task', 'meetings' => 'Meeting', 'calls' => 'Call', 'emails' => 'Email', 'notes' => 'Note');
     //Setup the arrays to store the linked records.
     foreach ($activitiesRels as $relMod => $beanName) {
         $varname = "focus_" . $relMod . "_list";
         ${$varname} = array();
     }
     foreach ($focus->get_linked_fields() as $field => $def) {
         if ($focus->load_relationship($field)) {
             $relTable = $focus->{$field}->getRelatedTableName();
             if (in_array($relTable, array_keys($activitiesRels))) {
                 $varname = "focus_" . $relTable . "_list";
                 ${$varname} = sugarArrayMerge(${$varname}, $focus->get_linked_beans($field, $activitiesRels[$relTable]));
             }
         }
     }
     foreach ($focus_tasks_list as $task) {
         $sort_date_time = '';
         if (empty($task->date_due) || $task->date_due == '0000-00-00') {
             $date_due = '';
         } else {
             $date_due = $task->date_due;
         }
         if ($task->status != "Not Started" && $task->status != "In Progress" && $task->status != "Pending Input") {
             $history_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_modified' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE'], 'sort_value' => strtotime($task->fetched_row['date_due'] . ' GMT'));
         } else {
             $open_activity_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_due' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE']);
         }
     }
     // end Tasks
     foreach ($focus_meetings_list as $meeting) {
         if (empty($meeting->contact_id) && empty($meeting->contact_name)) {
             $meeting_contacts = $meeting->get_linked_beans('contacts', 'Contact');
             if (!empty($meeting_contacts[0]->id) && !empty($meeting_contacts[0]->name)) {
                 $meeting->contact_id = $meeting_contacts[0]->id;
                 $meeting->contact_name = $meeting_contacts[0]->name;
             }
         }
         if ($meeting->status != "Planned") {
             $history_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_modified' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => strtotime($meeting->fetched_row['date_start'] . ' GMT'));
         } else {
             $open_activity_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_due' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START']);
         }
     }
     // end Meetings
     foreach ($focus_calls_list as $call) {
         if (empty($call->contact_id) && empty($call->contact_name)) {
             $call_contacts = $call->get_linked_beans('contacts', 'Contact');
             if (!empty($call_contacts[0]->id) && !empty($call_contacts[0]->name)) {
                 $call->contact_id = $call_contacts[0]->id;
                 $call->contact_name = $call_contacts[0]->name;
             }
         }
         if ($call->status != "Planned") {
             $history_list[] = array('name' => $call->name, 'id' => $call->id, 'type' => "Call", 'direction' => $call->direction, 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_modified' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => strtotime($call->fetched_row['date_start'] . ' GMT'));
         } else {
             $open_activity_list[] = array('name' => $call->name, 'id' => $call->id, 'direction' => $call->direction, 'type' => "Call", 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_due' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START']);
         }
     }
     // end Calls
     foreach ($focus_emails_list as $email) {
         if (empty($email->contact_id) && empty($email->contact_name)) {
             $email_contacts = $email->get_linked_beans('contacts', 'Contact');
             if (!empty($email_contacts[0]->id) && !empty($email_contacts[0]->name)) {
                 $email->contact_id = $email_contacts[0]->id;
                 $email->contact_name = $email_contacts[0]->name;
             }
         }
         $history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => strtotime($email->fetched_row['date_sent'] . ' GMT'));
     }
     //end Emails
     // Bug 46439 'No email archived when clicking on View Summary' (All condition)
     if (method_exists($focus, 'get_unlinked_email_query')) {
         $queryArray = $focus->get_unlinked_email_query(array('return_as_array' => 'true'));
         $query = $queryArray['select'];
         $query .= $queryArray['from'];
         if (!empty($queryArray['join_tables'])) {
             foreach ($queryArray['join_tables'] as $join_table) {
                 if ($join_table != '') {
                     $query .= ', ' . $join_table . ' ';
                 }
             }
         }
         $query .= $queryArray['join'];
         $query .= $queryArray['where'];
         $emails = new Email();
         $focus_unlinked_emails_list = $emails->process_list_query($query, 0);
         $focus_unlinked_emails_list = $focus_unlinked_emails_list['list'];
         foreach ($focus_unlinked_emails_list as $email) {
             $email->retrieve($email->id);
             $history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => strtotime($email->fetched_row['date_sent'] . ' GMT'));
         }
     }
     //end Unlinked Emails
     foreach ($focus_notes_list as $note) {
         $history_list[] = array('name' => $note->name, 'id' => $note->id, 'type' => "Note", 'direction' => '', 'module' => "Notes", 'status' => '', 'parent_id' => $note->parent_id, 'parent_type' => $note->parent_type, 'parent_name' => $note->parent_name, 'contact_id' => $note->contact_id, 'contact_name' => $note->contact_name, 'date_modified' => $note->date_modified, 'description' => $this->formatDescription($note->description), 'date_type' => $app_strings['DATA_TYPE_MODIFIED'], 'sort_value' => strtotime($note->fetched_row['date_modified'] . ' GMT'));
         if (!empty($note->filename)) {
             $count = count($history_list);
             $count--;
             $history_list[$count]['filename'] = $note->filename;
             $history_list[$count]['fileurl'] = UploadFile::get_url($note->filename, $note->id);
         }
     }
     // end Notes
     $xtpl = new XTemplate('modules/Activities/Popup_picker.html');
     $xtpl->assign('MOD', $mod_strings);
     $xtpl->assign('APP', $app_strings);
     insert_popup_header();
     //output header
     echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>";
     echo getClassicModuleTitle($focus->module_dir, array(translate('LBL_MODULE_NAME', $focus->module_dir), $focus->name), false);
     echo "</td><td align='right' class='moduleTitle'>";
     echo "<A href='javascript:print();' class='utilsLink'><img src='" . SugarThemeRegistry::current()->getImageURL("print.gif") . "' width='13' height='13' alt='" . $app_strings['LNK_PRINT'] . "' border='0' align='absmiddle'></a>&nbsp;<A href='javascript:print();' class='utilsLink'>" . $app_strings['LNK_PRINT'] . "</A>\n";
     echo "</td></tr></table>";
     $oddRow = true;
     if (count($history_list) > 0) {
         $history_list = array_csort($history_list, 'sort_value', SORT_DESC);
     }
     foreach ($history_list as $activity) {
         $activity_fields = array('ID' => $activity['id'], 'NAME' => $activity['name'], 'MODULE' => $activity['module'], 'CONTACT_NAME' => $activity['contact_name'], 'CONTACT_ID' => $activity['contact_id'], 'PARENT_TYPE' => $activity['parent_type'], 'PARENT_NAME' => $activity['parent_name'], 'PARENT_ID' => $activity['parent_id'], 'DATE' => $activity['date_modified'], 'DESCRIPTION' => $activity['description'], 'DATE_TYPE' => $activity['date_type']);
         if (empty($activity['direction'])) {
             $activity_fields['TYPE'] = $app_list_strings['activity_dom'][$activity['type']];
         } else {
             $activity_fields['TYPE'] = $app_list_strings['call_direction_dom'][$activity['direction']] . ' ' . $app_list_strings['activity_dom'][$activity['type']];
         }
         switch ($activity['type']) {
             case 'Call':
                 $activity_fields['STATUS'] = $app_list_strings['call_status_dom'][$activity['status']];
                 break;
             case 'Meeting':
                 $activity_fields['STATUS'] = $app_list_strings['meeting_status_dom'][$activity['status']];
                 break;
             case 'Task':
                 $activity_fields['STATUS'] = $app_list_strings['task_status_dom'][$activity['status']];
                 break;
         }
         if (isset($activity['location'])) {
             $activity_fields['LOCATION'] = $activity['location'];
         }
         if (isset($activity['filename'])) {
             $activity_fields['ATTACHMENT'] = "<a href='index.php?entryPoint=download&id=" . $activity['id'] . "&type=Notes' target='_blank'>" . SugarThemeRegistry::current()->getImage("attachment", "alt='" . $activity['filename'] . "' border='0' align='absmiddle'") . "</a>";
         }
         if (isset($activity['parent_type'])) {
             $activity_fields['PARENT_MODULE'] = $activity['parent_type'];
         }
         $xtpl->assign("ACTIVITY", $activity_fields);
         $xtpl->assign("ACTIVITY_MODULE_PNG", SugarThemeRegistry::current()->getImage($activity_fields['MODULE'] . '', 'border="0" alt="' . $activity_fields['NAME'] . '"'));
         if ($oddRow) {
             //todo move to themes
             $xtpl->assign("ROW_COLOR", 'oddListRow');
             $xtpl->assign("BG_COLOR", $odd_bg);
         } else {
             //todo move to themes
             $xtpl->assign("ROW_COLOR", 'evenListRow');
             $xtpl->assign("BG_COLOR", $even_bg);
         }
         $oddRow = !$oddRow;
         if (!empty($activity_fields['DESCRIPTION'])) {
             $xtpl->parse("history.row.description");
         }
         $xtpl->parse("history.row");
         // Put the rows in.
     }
     $xtpl->parse("history");
     $xtpl->out("history");
     insert_popup_footer();
 }
コード例 #6
0
ファイル: OpenListView.php プロジェクト: klr2003/sourceread
$xtpl->assign("APP", $app_strings);
$xtpl->assign('JSON_CONFIG_JAVASCRIPT', $json_config->get_static_json_server());
$xtpl->assign("SUGAR_VERSION", $sugar_version);
$xtpl->assign("JS_CUSTOM_VERSION", $sugar_config['js_custom_version']);
// Stick the form header out there.
$filter = get_select_options_with_id($current_module_strings['appointment_filter_dom'], $appointment_filter);
echo "<form method='POST' action='index.php'>\n";
echo "<input type='hidden' name='module' value='Home'>\n";
echo "<input type='hidden' name='action' value='index'>\n";
$day_filter = "<select name='appointment_filter' language='JavaScript' onchange='this.form.submit();'>{$filter}</select>";
echo get_form_header($current_module_strings['LBL_UPCOMING'], $current_module_strings['LBL_TODAY'] . $day_filter . ' (' . $timedate->to_display_date($later, false) . ') ', false);
echo "</form>\n";
$xtpl->assign("RETURN_URL", "&return_module={$currentModule}&return_action=DetailView&return_id=" . (is_object($focus) && !empty($focus->id) ? $focus->id : ""));
$oddRow = true;
if (count($open_activity_list) > 0) {
    $open_activity_list = array_csort($open_activity_list, 'normal_date_start', 'normal_time_start', SORT_ASC);
}
$today = $timedate->handle_offset('today', $timedate->dbDayFormat . ' ' . $timedate->dbTimeFormat, false);
$todayOffset = $timedate->handleOffsetMax('today', $timedate->dbDayFormat . ' ' . $timedate->dbTimeFormat, true);
foreach ($open_activity_list as $activity) {
    $concatActDate = $activity['normal_date_start'] . ' ' . $activity['normal_time_start'];
    if ($concatActDate < $today) {
        $time = "<font class='overdueTask'>" . $activity['date_start'] . ' ' . $activity['time_start'] . "</font>";
    } elseif ($concatActDate >= $todayOffset['min'] && $concatActDate <= $todayOffset['max']) {
        $time = "<font class='todaysTask'>" . $activity['date_start'] . ' ' . $activity['time_start'] . "</font>";
    } else {
        $time = "<font class='futureTask'>" . $activity['date_start'] . ' ' . $activity['time_start'] . "</font>";
    }
    $activity_fields = array('ID' => $activity['id'], 'NAME' => $activity['name'], 'TYPE' => $activity['type'], 'MODULE' => $activity['module'], 'STATUS' => $activity['status'], 'CONTACT_NAME' => $activity['contact_name'], 'CONTACT_ID' => $activity['contact_id'], 'PARENT_TYPE' => $activity['parent_type'], 'PARENT_NAME' => $activity['parent_name'], 'PARENT_ID' => $activity['parent_id'], 'TIME' => $time, 'TAG' => $activity['tag']);
    switch ($activity['parent_type']) {
        case 'Accounts':
コード例 #7
0
    $button .= "<input type='hidden' name='parent_type' value='{$currentModule}'>\n<input type='hidden' name='parent_id' value='{$focus->id}'>\n<input type='hidden' name='parent_name' value='{$focus->name}'>\n";
}
$button .= "<input type='hidden' name='return_module' value='" . $currentModule . "'>\n";
$button .= "<input type='hidden' name='return_action' value='" . $action . "'>\n";
$button .= "<input type='hidden' name='return_id' value='" . $focus->id . "'>\n";
$button .= "<input type='hidden' name='action'>\n";
$button .= "<input title='" . $current_module_strings['LBL_NEW_NOTE_BUTTON_TITLE'] . "' accessKey='" . $current_module_strings['LBL_NEW_NOTE_BUTTON_KEY'] . "' class='button' onclick=\"this.form.action.value='EditView';this.form.module.value='Notes'\" type='submit' name='button' value='" . $current_module_strings['LBL_NEW_NOTE_BUTTON_LABEL'] . "'>\n";
$button .= "<input title='" . $current_module_strings['LBL_TRACK_EMAIL_BUTTON_TITLE'] . "' accessKey='" . $current_module_strings['LBL_TRACK_EMAIL_BUTTON_KEY'] . "' class='button' onclick=\"this.form.type.value='archived';this.form.action.value='EditView';this.form.module.value='Emails'\" type='submit' name='button' value='" . $current_module_strings['LBL_TRACK_EMAIL_BUTTON_LABEL'] . "'>\n";
$button .= "<input title='" . $current_module_strings['LBL_ACCUMULATED_HISTORY_BUTTON_TITLE'] . "' accessKey='" . $current_module_strings['LBL_ACCUMULATED_HISTORY_BUTTON_KEY'] . "' class='button' type='button' onclick='open_popup(\"Activities\", \"600\", \"400\", \"&record={$focus->id}&module_name={$currentModule}\", true, false, {$encoded_popup_request_data});' name='button' value='" . $current_module_strings['LBL_ACCUMULATED_HISTORY_BUTTON_LABEL'] . "'>\n";
$button .= "</form>\n";
// Stick the form header out there.
echo get_form_header($current_module_strings['LBL_HISTORY'], $button, false);
$xtpl->assign("RETURN_URL", "&return_module={$currentModule}&return_action=DetailView&return_id={$focus->id}");
$oddRow = true;
if (count($history_list) > 0) {
    $history_list = array_csort($history_list, 'date_modified', SORT_DESC);
}
foreach ($history_list as $activity) {
    $activity_fields = array('ID' => $activity['id'], 'NAME' => $activity['name'], 'MODULE' => $activity['module'], 'CONTACT_NAME' => $activity['contact_name'], 'CONTACT_ID' => $activity['contact_id'], 'PARENT_TYPE' => $activity['parent_type'], 'PARENT_NAME' => $activity['parent_name'], 'PARENT_ID' => $activity['parent_id'], 'DATE' => $activity['date_modified']);
    if (empty($activity['direction'])) {
        $activity_fields['TYPE'] = $app_list_strings['activity_dom'][$activity['type']];
    } else {
        $activity_fields['TYPE'] = $app_list_strings['call_direction_dom'][$activity['direction']] . ' ' . $app_list_strings['activity_dom'][$activity['type']];
    }
    switch ($activity['type']) {
        case 'Call':
            $activity_fields['STATUS'] = $app_list_strings['call_status_dom'][$activity['status']];
            break;
        case 'Meeting':
            $activity_fields['STATUS'] = $app_list_strings['meeting_status_dom'][$activity['status']];
            break;
コード例 #8
0
 /**
  * Returns the history.
  *
  * @param $api
  * @param $args
  * @return array|mixed
  */
 public function getHistory($api, $args)
 {
     global $app_strings;
     global $app_list_strings;
     global $timedate;
     $history_list = array();
     $focus = BeanFactory::getBean($args['module'], $args['id']);
     $activitiesRels = array('tasks' => 'Task', 'meetings' => 'Meeting', 'calls' => 'Call', 'emails' => 'Email', 'notes' => 'Note');
     //Setup the arrays to store the linked records.
     foreach ($activitiesRels as $relMod => $beanName) {
         $varname = "focus_" . $relMod . "_list";
         ${$varname} = array();
     }
     foreach ($focus->get_linked_fields() as $field => $def) {
         if ($focus->load_relationship($field)) {
             $relTable = $focus->{$field}->getRelatedTableName();
             if (in_array($relTable, array_keys($activitiesRels))) {
                 $varname = "focus_" . $relTable . "_list";
                 ${$varname} = sugarArrayMerge(${$varname}, $focus->get_linked_beans($field, $activitiesRels[$relTable], array(), 0, 100));
             }
         }
     }
     foreach ($focus_tasks_list as $task) {
         $sort_date_time = '';
         if (empty($task->date_due) || $task->date_due == '0000-00-00') {
             $date_due = '';
         } else {
             $date_due = $task->date_due;
         }
         if ($task->status != "Not Started" && $task->status != "In Progress" && $task->status != "Pending Input") {
             $ts = '';
             if (!empty($task->fetched_row['date_due'])) {
                 //tasks can have an empty date due field
                 $ts = $timedate->fromDb($task->fetched_row['date_due'])->ts;
             }
             $history_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_modified' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE'], 'sort_value' => $ts);
         } else {
             $open_activity_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_due' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE']);
         }
     }
     // end Tasks
     foreach ($focus_meetings_list as $meeting) {
         if (empty($meeting->contact_id) && empty($meeting->contact_name)) {
             $meeting_contacts = $meeting->get_linked_beans('contacts', 'Contact', array(), 0, 100);
             if (!empty($meeting_contacts[0]->id) && !empty($meeting_contacts[0]->name)) {
                 $meeting->contact_id = $meeting_contacts[0]->id;
                 $meeting->contact_name = $meeting_contacts[0]->name;
             }
         }
         if ($meeting->status != "Planned") {
             $history_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_modified' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => $timedate->fromDb($meeting->fetched_row['date_start'])->ts);
         } else {
             $open_activity_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_due' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START']);
         }
     }
     // end Meetings
     foreach ($focus_calls_list as $call) {
         if (empty($call->contact_id) && empty($call->contact_name)) {
             $call_contacts = $call->get_linked_beans('contacts', 'Contact', array(), 0, 100);
             if (!empty($call_contacts[0]->id) && !empty($call_contacts[0]->name)) {
                 $call->contact_id = $call_contacts[0]->id;
                 $call->contact_name = $call_contacts[0]->name;
             }
         }
         if ($call->status != "Planned") {
             $history_list[] = array('name' => $call->name, 'id' => $call->id, 'type' => "Call", 'direction' => $call->direction, 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_modified' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => $timedate->fromDb($call->fetched_row['date_start'])->ts);
         } else {
             $open_activity_list[] = array('name' => $call->name, 'id' => $call->id, 'direction' => $call->direction, 'type' => "Call", 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_due' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START']);
         }
     }
     // end Calls
     foreach ($focus_emails_list as $email) {
         if (empty($email->contact_id) && empty($email->contact_name)) {
             $email_contacts = $email->get_linked_beans('contacts', 'Contact', array(), 0, 100);
             if (!empty($email_contacts[0]->id) && !empty($email_contacts[0]->name)) {
                 $email->contact_id = $email_contacts[0]->id;
                 $email->contact_name = $email_contacts[0]->name;
             }
         }
         $ts = '';
         if (!empty($email->fetched_row['date_sent'])) {
             //emails can have an empty date sent field
             $ts = $timedate->fromDb($email->fetched_row['date_sent'])->ts;
         }
         $history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => $ts);
     }
     //end Emails
     // Bug 46439 'No email archived when clicking on View Summary' (All condition)
     if (method_exists($focus, 'get_unlinked_email_query')) {
         $queryArray = $focus->get_unlinked_email_query(array('return_as_array' => 'true'));
         $query = $queryArray['select'];
         $query .= $queryArray['from'];
         if (!empty($queryArray['join_tables'])) {
             foreach ($queryArray['join_tables'] as $join_table) {
                 if ($join_table != '') {
                     $query .= ', ' . $join_table . ' ';
                 }
             }
         }
         $query .= $queryArray['join'];
         $query .= $queryArray['where'];
         $emails = BeanFactory::getBean('Emails');
         $focus_unlinked_emails_list = $emails->process_list_query($query, 0);
         $focus_unlinked_emails_list = $focus_unlinked_emails_list['list'];
         foreach ($focus_unlinked_emails_list as $email) {
             $email->retrieve($email->id);
             $history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => strtotime($email->fetched_row['date_sent'] . ' GMT'));
         }
     }
     //end Unlinked Emails
     foreach ($focus_notes_list as $note) {
         if ($note->ACLAccess('view')) {
             $history_list[] = array('name' => $note->name, 'id' => $note->id, 'type' => "Note", 'direction' => '', 'module' => "Notes", 'status' => '', 'parent_id' => $note->parent_id, 'parent_type' => $note->parent_type, 'parent_name' => $note->parent_name, 'contact_id' => $note->contact_id, 'contact_name' => $note->contact_name, 'date_modified' => $note->date_modified, 'description' => $this->formatDescription($note->description), 'date_type' => $app_strings['DATA_TYPE_MODIFIED'], 'sort_value' => strtotime($note->fetched_row['date_modified'] . ' GMT'));
             if (!empty($note->filename)) {
                 $count = count($history_list);
                 $count--;
                 $history_list[$count]['filename'] = $note->filename;
                 $history_list[$count]['fileurl'] = UploadFile::get_url($note->filename, $note->id);
             }
         }
     }
     // end Notes
     $oddRow = true;
     $result = array();
     if (count($history_list) > 0) {
         $history_list = array_csort($history_list, 'sort_value', SORT_DESC);
     }
     foreach ($history_list as $activity) {
         $activity_fields = array('ID' => $activity['id'], 'NAME' => $activity['name'], 'MODULE' => $activity['module'], 'CONTACT_NAME' => $activity['contact_name'], 'CONTACT_ID' => $activity['contact_id'], 'PARENT_TYPE' => $activity['parent_type'], 'PARENT_NAME' => $activity['parent_name'], 'PARENT_ID' => $activity['parent_id'], 'DATE' => $activity['date_modified'], 'DESCRIPTION' => $activity['description'], 'DATE_TYPE' => $activity['date_type']);
         if (empty($activity['direction'])) {
             $activity_fields['TYPE'] = $app_list_strings['activity_dom'][$activity['type']];
         } else {
             $activity_fields['TYPE'] = $app_list_strings['call_direction_dom'][$activity['direction']] . ' ' . $app_list_strings['activity_dom'][$activity['type']];
         }
         switch ($activity['type']) {
             case 'Call':
                 $activity_fields['STATUS'] = $app_list_strings['call_status_dom'][$activity['status']];
                 break;
             case 'Meeting':
                 $activity_fields['STATUS'] = $app_list_strings['meeting_status_dom'][$activity['status']];
                 break;
             case 'Task':
                 $activity_fields['STATUS'] = $app_list_strings['task_status_dom'][$activity['status']];
                 break;
         }
         if (isset($activity['location'])) {
             $activity_fields['LOCATION'] = $activity['location'];
         }
         if (isset($activity['filename'])) {
             $activity_fields['ATTACHMENT'] = "<a href='index.php?entryPoint=download&id=" . $activity['id'] . "&type=Notes' target='_blank'>" . SugarThemeRegistry::current()->getImage("attachment", "border='0' align='absmiddle'", null, null, '.gif', $activity['filename']) . "</a>";
         }
         if (isset($activity['parent_type'])) {
             $activity_fields['PARENT_MODULE'] = $activity['parent_type'];
         }
         $result[] = $activity;
     }
     if (isset($focus->name)) {
         $name = $focus->name;
     } else {
         if ($focus->full_name) {
             $name = $focus->full_name;
         }
     }
     $response = array('module_key' => $focus->module_name, 'name' => $name, 'history' => $result);
     return $response;
 }
コード例 #9
0
ファイル: udb_base.inc.php プロジェクト: phill104/branches
 function util_filloptions()
 {
     global $lang_util_php, $CONFIG;
     if ($this->can_join_tables) {
         // Reset counter
         $list_count = 0;
         $user_albums = cpg_db_query("SELECT aid, IF({$this->field['username']} IS NOT NULL,\n                                                                CONCAT('(', {$this->field['username']}, ') ', a.title),\n                                                                CONCAT(' - ', a.title)) AS title\n                                                                FROM {$CONFIG['TABLE_ALBUMS']} AS a\n                                                                INNER JOIN {$this->usertable} AS u\n                                                                ON category = (" . FIRST_USER_CAT . " + {$this->field['user_id']})\n                                                                ORDER BY a.title");
         $user_albums_list = cpg_db_fetch_rowset($user_albums);
         $public_albums = cpg_db_query("SELECT aid, title, name FROM {$CONFIG['TABLE_ALBUMS']} LEFT JOIN {$CONFIG['TABLE_CATEGORIES']} ON cid = category WHERE category < " . FIRST_USER_CAT . " ORDER BY title");
         $public_albums_list = cpg_db_fetch_rowset($public_albums);
         // Cycle through the User albums
         foreach ($user_albums_list as $album) {
             // Add to multi-dim array for later sorting
             //$listArray[$list_count]['cat'] = $lang_upload_php['personal_albums'];
             $listArray[$list_count]['cat'] = "* Personal Albums";
             $listArray[$list_count]['aid'] = $album['aid'];
             $listArray[$list_count]['title'] = $album['title'];
             $list_count++;
         }
         // Cycle through the public albums
         foreach ($public_albums_list as $album) {
             // Set $album_id to the actual album ID
             $album_id = $album['aid'];
             // Get the category name
             // $vQuery = "SELECT cat.name FROM " . $CONFIG['TABLE_CATEGORIES'] . " cat, " . $CONFIG['TABLE_ALBUMS'] . " alb WHERE alb.aid='" . $album_id . "' AND cat.cid=alb.category";
             //$vRes = cpg_db_query($vQuery);
             //$vRes = mysql_fetch_array($vRes);
             // Add to multi-dim array for sorting later
             $vRes['name'] = $album['name'];
             if ($vRes['name']) {
                 $listArray[$list_count]['cat'] = $vRes['name'];
             } else {
                 //$listArray[$list_count]['cat'] = $lang_upload_php['albums_no_category'];
                 $listArray[$list_count]['cat'] = "Albums with no category";
             }
             $listArray[$list_count]['aid'] = $album['aid'];
             $listArray[$list_count]['title'] = $album['title'];
             $list_count++;
         }
         // Sort the pulldown options by category and album name
         $listArray = array_csort($listArray, 'cat', 'title');
         // Finally, print out the nicely sorted and formatted drop down list
         $alb_cat = '';
         echo '&nbsp;&nbsp;&nbsp;&nbsp;<select size="1" name="albumid" class="listbox"><option value="0">All Albums</option>';
         foreach ($listArray as $val) {
             if ($val['cat'] != $alb_cat) {
                 if ($alb_cat) {
                     echo "                </optgroup>\n";
                 }
                 echo '                <optgroup label="' . $val['cat'] . '">' . "\n";
                 $alb_cat = $val['cat'];
             }
             echo '                <option value="' . $val['aid'] . '"' . ($val['aid'] == $sel_album ? ' selected' : '') . '>   ' . $val['title'] . "</option>\n";
         }
         if ($alb_cat) {
             echo "                </optgroup>\n";
         }
         print '</select> (3)';
         print '&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="' . $lang_util_php['submit_form'] . '" class="button" /> (4)';
         print '</form>';
     } else {
         // Query for list of public albums
         $public_albums = cpg_db_query("SELECT aid, title, category FROM {$CONFIG['TABLE_ALBUMS']} WHERE category < " . FIRST_USER_CAT . " ORDER BY title");
         if (mysql_num_rows($public_albums)) {
             $public_result = cpg_db_fetch_rowset($public_albums);
         } else {
             $public_result = array();
         }
         // Initialize $merged_array
         $merged_array = array();
         // Count the number of albums returned.
         $end = count($public_result);
         // Cylce through the User albums.
         for ($i = 0; $i < $end; $i++) {
             //Create a new array sow we may sort the final results.
             $merged_array[$i]['id'] = $public_result[$i]['aid'];
             $merged_array[$i]['album_name'] = $public_result[$i]['title'];
             // Query the database to get the category name.
             $vQuery = "SELECT name, parent FROM " . $CONFIG['TABLE_CATEGORIES'] . " WHERE cid='" . $public_result[$i]['category'] . "'";
             $vRes = mysql_query($vQuery);
             $vRes = mysql_fetch_array($vRes);
             if (isset($merged_array[$i]['username_category'])) {
                 $merged_array[$i]['username_category'] = ($vRes['name'] ? '(' . $vRes['name'] . ') ' : '') . $merged_array[$i]['username_category'];
             } else {
                 $merged_array[$i]['username_category'] = $vRes['name'] ? '(' . $vRes['name'] . ') ' : '';
             }
         }
         // We transpose and divide the matrix into columns to prepare it for use in array_multisort().
         foreach ($merged_array as $key => $row) {
             $aid[$key] = $row['id'];
             $title[$key] = $row['album_name'];
             $album_lineage[$key] = $row['username_category'];
         }
         // We sort all columns in descending order and plug in $album_menu at the end so it is sorted by the common key.
         array_multisort($album_lineage, SORT_ASC, $title, SORT_ASC, $aid, SORT_ASC, $merged_array);
         // Query for list of user albums
         $user_albums = cpg_db_query("SELECT aid, title, category FROM {$CONFIG['TABLE_ALBUMS']} WHERE category >= " . FIRST_USER_CAT . " ORDER BY aid");
         if (mysql_num_rows($user_albums)) {
             $user_albums_list = cpg_db_fetch_rowset($user_albums);
         } else {
             $user_albums_list = array();
         }
         // Query for list of user IDs and names
         $user_album_ids_and_names = cpg_db_query("\n                                SELECT ({$this->field['user_id']} + " . FIRST_USER_CAT . ") AS id,\n                                CONCAT('(', {$this->field['username']}, ') ') as name\n                                FROM {$this->usertable}\n                                ORDER BY name ASC", $this->link_id);
         if (mysql_num_rows($user_album_ids_and_names)) {
             $user_album_ids_and_names_list = cpg_db_fetch_rowset($user_album_ids_and_names);
         } else {
             $user_album_ids_and_names_list = array();
         }
         // Glue what we've got together.
         // Initialize $udb_i as a counter.
         if (count($merged_array)) {
             $udb_i = count($merged_array);
         } else {
             $udb_i = 0;
         }
         //Begin a set of nested loops to merge the various query results.
         foreach ($user_albums_list as $aq) {
             foreach ($user_album_ids_and_names_list as $uq) {
                 if ($aq['category'] == $uq['id']) {
                     $merged_array[$udb_i]['id'] = $aq['category'];
                     $merged_array[$udb_i]['album_name'] = $aq['title'];
                     $merged_array[$udb_i]['username_category'] = $uq['name'];
                     $udb_i++;
                 }
             }
         }
         // The user albums and public albums have been merged into one list. Print the dropdown.
         echo '&nbsp;&nbsp;&nbsp;&nbsp;<select size="1" name="albumid" class="listbox"><option value="0">All Albums</option>';
         foreach ($merged_array as $menu_item) {
             echo "<option value=\"" . $menu_item['id'] . "\">" . (isset($menu_item['username_category']) ? $menu_item['username_category'] : '') . $menu_item['album_name'] . "</option>\n";
         }
         // Close list, etc.
         print '</select> (3)';
         print '&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="' . $lang_util_php['submit_form'] . '" class="button" /> (4)';
         // print '</form>';
     }
 }
コード例 #10
0
ファイル: class_totals_xml.php プロジェクト: vinod-co/centa
if ($propertyObj->get_pass_mark() == 101) {
    $borderline_method = true;
} else {
    $borderline_method = false;
}
if ($borderline_method) {
    $passmark = getBlinePassmk($user_results, $user_no, $propertyObj);
} elseif ($propertyObj->get_pass_mark() == 102) {
    $passmark = 'N/A';
} else {
    $passmark = $propertyObj->get_pass_mark();
}
$distinction_mark = $propertyObj->get_distinction_mark();
set_classification($propertyObj->get_marking(), $user_results, $passmark, $user_no, $string);
rating_num_text($user_results, $user_no, $propertyObj, $string);
$user_results = array_csort($user_results, $sortby, $ordering);
header('Pragma: public');
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=" . str_replace(' ', '_', $paper) . ".xml");
if ($borderline_method) {
    $col_count = 11;
} else {
    $col_count = 10;
}
// Write results to XML ---------------------------------------------------------------------------
echo '<?xml version="1.0"?>';
echo '<?mso-application progid="Excel.Sheet"?>';
echo '<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"';
echo ' xmlns:o="urn:schemas-microsoft-com:office:office"';
echo ' xmlns:x="urn:schemas-microsoft-com:office:excel"';
echo ' xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"';
コード例 #11
0
// ---------------------------------------------------
function array_csort($marray, $column)
{
    if (is_array($marray)) {
        $sortarr = array();
        foreach ($marray as $key => $row) {
            $sortarr[$key] = $row[$column];
        }
        array_multisort($sortarr, $marray);
        return $marray;
    } else {
        return array();
    }
}
$catree = $categlib->list_all_categories(0, -1, 'name_asc', '', '', 0);
$catree = array_csort($catree['data'], 'categpath');
$smarty->assign('catree', $catree);
// var_dump($catree);
// ---------------------------------------------------
$smarty->assign('assign_perms', 'checked');
if (!isset($_REQUEST["sort_mode"])) {
    $sort_mode = 'name_asc';
} else {
    $sort_mode = $_REQUEST["sort_mode"];
}
if (!isset($_REQUEST["offset"])) {
    $offset = 0;
} else {
    $offset = $_REQUEST["offset"];
}
$smarty->assign_by_ref('offset', $offset);
コード例 #12
0
ファイル: upload.php プロジェクト: phill104/branches
function form_alb_list_box($text, $name)
{
    // Pull the $CONFIG array and the GET array into the function
    global $CONFIG, $lang_upload_php;
    // Also pull the album lists into the function
    global $user_albums_list, $public_albums_list;
    // Check to see if an album has been preselected by URL addition or the last selected album. If so, make $sel_album the album number. Otherwise, make $sel_album 0.
    if (isset($_GET['album'])) {
        $sel_album = $_GET['album'];
    } elseif (isset($_POST['album'])) {
        $sel_album = $_POST['album'];
    } else {
        $sel_album = 0;
    }
    // Create the opening of the drop down box
    echo <<<EOT
    <tr>
        <td class="tableb">
            {$text}
        </td>
        <td class="tableb" valign="top">
            <select name="{$name}" class="listbox">

EOT;
    // Get the ancestry of the categories
    $vQuery = "SELECT cid, parent, name FROM " . $CONFIG['TABLE_CATEGORIES'] . " WHERE 1";
    $vResult = cpg_db_query($vQuery);
    $vRes = cpg_db_fetch_rowset($vResult);
    mysql_free_result($vResult);
    foreach ($vRes as $vResI => $vResV) {
        $vResRow = $vRes[$vResI];
        $catParent[$vResRow['cid']] = $vResRow['parent'];
        $catName[$vResRow['cid']] = $vResRow['name'];
    }
    $catAnces = array();
    foreach ($catParent as $cid => $cid_parent) {
        $catAnces[$cid] = '';
        while ($cid_parent != 0) {
            $catAnces[$cid] = $catName[$cid_parent] . ($catAnces[$cid] ? ' - ' . $catAnces[$cid] : '');
            $cid_parent = $catParent[$cid_parent];
        }
    }
    // Reset counter
    $list_count = 0;
    // Cycle through the User albums
    foreach ($user_albums_list as $album) {
        // Add to multi-dim array for later sorting
        $listArray[$list_count]['cat'] = $lang_upload_php['personal_albums'];
        $listArray[$list_count]['aid'] = $album['aid'];
        $listArray[$list_count]['title'] = $album['title'];
        $list_count++;
    }
    // Cycle through the public albums
    foreach ($public_albums_list as $album) {
        // Set $album_id to the actual album ID
        $album_id = $album['aid'];
        // Get the category name
        $vQuery = "SELECT cat.name, cat.cid FROM " . $CONFIG['TABLE_CATEGORIES'] . " cat, " . $CONFIG['TABLE_ALBUMS'] . " alb WHERE alb.aid='" . $album_id . "' AND cat.cid=alb.category";
        $vResult = cpg_db_query($vQuery);
        $vRes = cpg_db_fetch_row($vResult);
        mysql_free_result($vResult);
        // Add to multi-dim array for sorting later
        if ($vRes['name']) {
            $listArray[$list_count]['cat'] = $catAnces[$vRes['cid']] . ($catAnces[$vRes['cid']] ? ' - ' : '') . $vRes['name'];
            $listArray[$list_count]['cid'] = $vRes['cid'];
        } else {
            $listArray[$list_count]['cat'] = $lang_upload_php['albums_no_category'];
            $listArray[$list_count]['cid'] = 0;
        }
        $listArray[$list_count]['aid'] = $album['aid'];
        $listArray[$list_count]['title'] = $album['title'];
        $list_count++;
    }
    // Sort the pulldown options by category and album name
    $listArray = array_csort($listArray, 'cat', 'title');
    // alphabetically by category name
    // $listArray = array_csort($listArray,'cid','title');  // numerically by category ID
    // print_r($listArray);exit;
    // Finally, print out the nicely sorted and formatted drop down list
    $alb_cat = '';
    echo '                <option value="">' . $lang_upload_php['select_album'] . "</option>\n";
    foreach ($listArray as $val) {
        //if ($val['cat'] != $alb_cat) {  // old method compared names which might not be unique
        if ($val['cid'] != $alb_cat) {
            if ($alb_cat) {
                echo "                </optgroup>\n";
            }
            echo '                <optgroup label="' . $val['cat'] . '">' . "\n";
            $alb_cat = $val['cid'];
        }
        echo '                <option value="' . $val['aid'] . '"' . ($val['aid'] == $sel_album ? ' selected' : '') . '>   ' . $val['title'] . "</option>\n";
    }
    if ($alb_cat) {
        echo "                </optgroup>\n";
    }
    // Close the drop down
    echo <<<EOT
            </select>
        </td>
    </tr>

EOT;
}
コード例 #13
0
ファイル: functions.inc.php プロジェクト: phill104/branches
/**
 * function upload_form_alb_list()
 *
 * Print a list of albums in HTML for upload.php and albums or pictures in XML for the API
 * 
 * @param string $text
 * @param string $name
 *
 */
function upload_form_alb_list($text, $name, $type = 0)
{
    $superCage = Inspekt::makeSuperCage();
    // Pull the $CONFIG array and the GET array into the function
    global $CONFIG, $lang_upload_php;
    // Also pull the album lists into the function
    global $user_albums_list, $public_albums_list;
    // Check to see if an album has been preselected by URL addition or the last selected album. If so, make $sel_album the album number. Otherwise, make $sel_album 0.
    if ($superCage->get->keyExists('album')) {
        $sel_album = $superCage->get->getInt('album');
    } elseif ($superCage->post->keyExists('album')) {
        $sel_album = $superCage->post->getInt('album');
    } else {
        $sel_album = 0;
    }
    // Get the ancestry of the categories
    $vQuery = "SELECT cid, parent, name FROM " . $CONFIG['TABLE_CATEGORIES'] . " WHERE 1";
    $vResult = cpg_db_query($vQuery);
    $vRes = cpg_db_fetch_rowset($vResult);
    mysql_free_result($vResult);
    foreach ($vRes as $vResI => $vResV) {
        $vResRow = $vRes[$vResI];
        $catParent[$vResRow['cid']] = $vResRow['parent'];
        $catName[$vResRow['cid']] = $vResRow['name'];
    }
    $catAnces = array();
    foreach ($catParent as $cid => $cid_parent) {
        $catAnces[$cid] = '';
        while ($cid_parent != 0) {
            $catAnces[$cid] = $catName[$cid_parent] . ($catAnces[$cid] ? ' - ' . $catAnces[$cid] : '');
            $cid_parent = $catParent[$cid_parent];
        }
    }
    // Reset counter
    $list_count = 0;
    // Cycle through the User albums
    foreach ($user_albums_list as $album) {
        // Add to multi-dim array for later sorting
        $listArray[$list_count]['cat'] = $lang_upload_php['personal_albums'];
        $listArray[$list_count]['aid'] = $album['aid'];
        $listArray[$list_count]['title'] = $album['title'];
        $list_count++;
    }
    // Cycle through the public albums
    foreach ($public_albums_list as $album) {
        // Set $album_id to the actual album ID
        $album_id = $album['aid'];
        // Add to multi-dim array for sorting later
        if ($album['name']) {
            $listArray[$list_count]['cat'] = $catAnces[$album['cid']] . ($catAnces[$album['cid']] ? ' - ' : '') . $album['name'];
            $listArray[$list_count]['cid'] = $album['cid'];
        } else {
            $listArray[$list_count]['cat'] = $lang_upload_php['albums_no_category'];
            $listArray[$list_count]['cid'] = 0;
        }
        $listArray[$list_count]['aid'] = $album['aid'];
        $listArray[$list_count]['title'] = $album['title'];
        $list_count++;
    }
    /* Output XML - for API */
    if (defined('API_CALL')) {
        if ($superCage->post->getAlpha('function') == 'alblist') {
            $listArray = array_csort($listArray, 'aid');
            // Sort the array alphabetically by aid
            echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
            echo "<album_list>\n";
            foreach ($listArray as $val) {
                echo ' <album id="' . $val['aid'] . '">' . "\n";
                echo '  <title>' . $val['title'] . '</title>' . "\n";
                echo '  <cat_id>' . $val['cid'] . '</cat_id>' . "\n";
                echo ' </album>' . "\n";
            }
            echo "</album_list>";
        } else {
            if ($superCage->post->getAlpha('function') == 'piclist') {
                $listArray = array_csort($listArray, 'cat', 'title');
                // alphabetically by category name
                echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
                echo "<album" . $superCage->post->getInt('album') . ">\n";
                foreach ($listArray as $val) {
                    // Picture list
                    $result = cpg_db_query("SELECT pid, title, filepath, filename, pwidth, pheight, caption FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = {$val['aid']} AND approved='YES'");
                    while ($row = mysql_fetch_assoc($result)) {
                        echo ' <picture id="' . $row['pid'] . '">' . "\n";
                        echo '  <title>' . $row['title'] . '</title>' . "\n";
                        echo '  <file>' . $row['filepath'] . $row['filename'] . '</file>' . "\n";
                        echo '  <width>' . $row['pwidth'] . '</width>' . "\n";
                        echo '  <height>' . $row['pheight'] . '</height>' . "\n";
                        echo '  <caption>' . $row['caption'] . '</caption>' . "\n";
                        echo ' </picture>' . "\n";
                    }
                    mysql_free_result($result);
                }
                echo "</album" . $superCage->post->getInt('album') . ">";
            } else {
                die('<api_error>Unknown API function.</api_error>');
            }
        }
        header('Content-Type: text/xml');
        return;
    }
    /* Output HTML - for upload.php */
    // Sort the pulldown options by category and album name
    $listArray = array_csort($listArray, 'cat', 'title');
    // alphabetically by category name
    // $listArray = array_csort($listArray,'cid','title');  // numerically by category ID
    // print_r($listArray);exit;
    //this will create for normal files
    if ($type == 0) {
        // Create the opening of the drop down box
        echo <<<EOT
    <tr>
        <td class="tableb">
            {$text}
        </td>
        <td class="tableb" valign="top">
            <select name="{$name}" class="listbox">

EOT;
        // Finally, print out the nicely sorted and formatted drop down list
        $alb_cat = '';
        echo '                <option value="">' . $lang_upload_php['select_album'] . "</option>\n";
        foreach ($listArray as $val) {
            //if ($val['cat'] != $alb_cat) {  // old method compared names which might not be unique
            if ($val['cid'] != $alb_cat) {
                if ($alb_cat) {
                    echo "                </optgroup>\n";
                }
                echo '                <optgroup label="' . $val['cat'] . '">' . "\n";
                $alb_cat = $val['cid'];
            }
            echo '                <option value="' . $val['aid'] . '"' . ($val['aid'] == $sel_album ? ' selected' : '') . '>   ' . $val['title'] . "</option>\n";
        }
        if ($alb_cat) {
            echo "                </optgroup>\n";
        }
        // Close the drop down
        echo <<<EOT
            </select>
        </td>
    </tr>

EOT;
    }
    //end
    /**this create for set javascript variable*/
    if ($type == 1) {
        $jDropDwon = '';
        $jDropDwon .= <<<EOT
    \t\t<div>
        \t\t<lable>
\t\t            {$text}
        \t\t</lable>
        <div>
            <select name="{$name}" class="listbox">

EOT;
        // Finally, print out the nicely sorted and formatted drop down list
        $alb_cat = '';
        $jDropDwon .= '<option value="">' . $lang_upload_php['select_album'] . "</option>\n";
        foreach ($listArray as $val) {
            //if ($val['cat'] != $alb_cat) {  // old method compared names which might not be unique
            if ($val['cid'] != $alb_cat) {
                if ($alb_cat) {
                    $jDropDwon .= "</optgroup>\n";
                }
                $jDropDwon .= '<optgroup label="' . $val['cat'] . '">' . "\n";
                $alb_cat = $val['cid'];
            }
            $jDropDwon .= '<option value="' . $val['aid'] . '"' . ($val['aid'] == $sel_album ? ' selected' : '') . '>   ' . $val['title'] . "</option>\n";
        }
        if ($alb_cat) {
            $jDropDwon .= "</optgroup>\n";
        }
        // Close the drop down
        $jDropDwon .= <<<EOT
            </select>
        </div>
    </div>

EOT;
        return $jDropDwon;
    }
}
コード例 #14
0
 /**
  *
  */
 function process_page()
 {
     global $theme;
     global $focus;
     global $mod_strings;
     global $app_strings;
     global $app_list_strings;
     global $currentModule;
     global $odd_bg;
     global $even_bg;
     global $image_path;
     $theme_path = "themes/" . $theme . "/";
     $image_path = 'themes/' . $theme . '/images/';
     require_once $theme_path . 'layout_utils.php';
     $history_list = array();
     if (!empty($_REQUEST['record'])) {
         $result = $focus->retrieve($_REQUEST['record']);
         if ($result == null) {
             sugar_die($app_strings['ERROR_NO_RECORD']);
         }
     }
     if ($focus->object_name == "ProjectTask" || $focus->object_name == "Project") {
         $focus_tasks_list = array();
     } else {
         $focus_tasks_list = $focus->get_linked_beans('tasks', 'Task');
     }
     $focus_meetings_list = $focus->get_linked_beans('meetings', 'Meeting');
     $focus_calls_list = $focus->get_linked_beans('calls', 'Call');
     $focus_emails_list = $focus->get_linked_beans('emails', 'Email');
     $focus_notes_list = $focus->get_linked_beans('notes', 'Note');
     foreach ($focus_tasks_list as $task) {
         if ($task->date_due == '0000-00-00') {
             $date_due = '';
         } else {
             $date_due = $task->date_due;
         }
         if ($task->status != "Not Started" && $task->status != "In Progress" && $task->status != "Pending Input") {
             $history_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_modified' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => 'Due:');
         } else {
             $open_activity_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_due' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => 'Due:');
         }
     }
     // end Tasks
     foreach ($focus_meetings_list as $meeting) {
         if ($meeting->status != "Planned") {
             $history_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_modified' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => 'Start:');
         } else {
             $open_activity_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_due' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => 'Start:');
         }
     }
     // end Meetings
     foreach ($focus_calls_list as $call) {
         if ($call->status != "Planned") {
             $history_list[] = array('name' => $call->name, 'id' => $call->id, 'type' => "Call", 'direction' => $call->direction, 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_modified' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => 'Start:');
         } else {
             $open_activity_list[] = array('name' => $call->name, 'id' => $call->id, 'direction' => $call->direction, 'type' => "Call", 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_due' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => 'Start:');
         }
     }
     // end Calls
     foreach ($focus_emails_list as $email) {
         $history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => 'Sent:');
     }
     //end Emails
     foreach ($focus_notes_list as $note) {
         $history_list[] = array('name' => $note->name, 'id' => $note->id, 'type' => "Note", 'direction' => '', 'module' => "Notes", 'status' => '', 'parent_id' => $note->parent_id, 'parent_type' => $note->parent_type, 'parent_name' => $note->parent_name, 'contact_id' => $note->contact_id, 'contact_name' => $note->contact_name, 'date_modified' => $note->date_modified, 'description' => $this->formatDescription($note->description), 'date_type' => 'Modified:');
         if (!empty($note->filename)) {
             $count = count($history_list);
             $count--;
             $history_list[$count]['filename'] = $note->filename;
             $history_list[$count]['fileurl'] = UploadFile::get_url($note->filename, $note->id);
         }
     }
     // end Notes
     $xtpl = new XTemplate('modules/Activities/Popup_picker.html');
     $xtpl->assign('THEME', $theme);
     $xtpl->assign('MOD', $mod_strings);
     $xtpl->assign('APP', $app_strings);
     insert_popup_header($theme);
     //output header
     echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>";
     echo get_module_title($focus->module_dir, $focus->module_dir . ": " . $focus->name, false);
     echo "</td><td align='right' class='moduleTitle'>";
     echo "<A href='javascript:print();' class='utilsLink'><img src='" . $image_path . "print.gif' width='13' height='13' alt='" . $app_strings['LNK_PRINT'] . "' border='0' align='absmiddle'></a>&nbsp;<A href='javascript:print();' class='utilsLink'>" . $app_strings['LNK_PRINT'] . "</A>\n";
     echo "</td></tr></table>";
     $oddRow = true;
     if (count($history_list) > 0) {
         $history_list = array_csort($history_list, 'date_modified', SORT_DESC);
     }
     foreach ($history_list as $activity) {
         $activity_fields = array('ID' => $activity['id'], 'NAME' => $activity['name'], 'MODULE' => $activity['module'], 'CONTACT_NAME' => $activity['contact_name'], 'CONTACT_ID' => $activity['contact_id'], 'PARENT_TYPE' => $activity['parent_type'], 'PARENT_NAME' => $activity['parent_name'], 'PARENT_ID' => $activity['parent_id'], 'DATE' => $activity['date_modified'], 'DESCRIPTION' => $activity['description'], 'DATE_TYPE' => $activity['date_type']);
         if (empty($activity['direction'])) {
             $activity_fields['TYPE'] = $app_list_strings['activity_dom'][$activity['type']];
         } else {
             $activity_fields['TYPE'] = $app_list_strings['call_direction_dom'][$activity['direction']] . ' ' . $app_list_strings['activity_dom'][$activity['type']];
         }
         switch ($activity['type']) {
             case 'Call':
                 $activity_fields['STATUS'] = $app_list_strings['call_status_dom'][$activity['status']];
                 break;
             case 'Meeting':
                 $activity_fields['STATUS'] = $app_list_strings['meeting_status_dom'][$activity['status']];
                 break;
             case 'Task':
                 $activity_fields['STATUS'] = $app_list_strings['task_status_dom'][$activity['status']];
                 break;
         }
         if (isset($activity['location'])) {
             $activity_fields['LOCATION'] = $activity['location'];
         }
         if (isset($activity['filename'])) {
             $activity_fields['ATTACHMENT'] = "<a href='" . $activity['fileurl'] . "' target='_blank'>" . get_image($image_path . "attachment", "alt='" . $activity['filename'] . "' border='0' align='absmiddle'") . "</a>";
         }
         if (isset($activity['parent_type'])) {
             $activity_fields['PARENT_MODULE'] = $activity['parent_type'];
         }
         $xtpl->assign("ACTIVITY", $activity_fields);
         $xtpl->assign("ACTIVITY_MODULE_PNG", get_image($image_path . $activity_fields['MODULE'] . '', 'border="0" alt="' . $activity_fields['NAME'] . '"'));
         if ($oddRow) {
             //todo move to themes
             $xtpl->assign("ROW_COLOR", 'oddListRow');
             $xtpl->assign("BG_COLOR", $odd_bg);
         } else {
             //todo move to themes
             $xtpl->assign("ROW_COLOR", 'evenListRow');
             $xtpl->assign("BG_COLOR", $even_bg);
         }
         $oddRow = !$oddRow;
         $xtpl->parse("history.row");
         // Put the rows in.
     }
     $xtpl->parse("history");
     $xtpl->out("history");
     insert_popup_footer();
 }
コード例 #15
0
ファイル: recycle_list.php プロジェクト: vinod-co/centa
<?php 
require '../include/recycle_options_menu.inc';
require '../include/toprightmenu.inc';
echo draw_toprightmenu();
$recycle_bin = RecycleBin::get_recyclebin_contents($userObject, $mysqli);
$mysqli->close();
$sortby = 'name';
if (isset($_GET['sortby'])) {
    $sortby = $_GET['sortby'];
}
$ordering = 'asc';
if (isset($_GET['ordering'])) {
    $ordering = $_GET['ordering'];
}
if (count($recycle_bin) > 0) {
    $recycle_bin = array_csort($recycle_bin, $sortby, $ordering);
}
?>
<div id="content">
  
<div class="head_title">
  <div><img src="../artwork/toprightmenu.gif" id="toprightmenu_icon" /></div>
  <div class="breadcrumb"><a href="../index.php"><?php 
echo $string['home'];
?>
</a></div>
  <div class="page_title"><?php 
echo $string['recyclebin'];
?>
</div>
</div>  
コード例 #16
0
                $performance['calendar_year'] = '?';
            }
            $display_data[$row]['calendar_year'] = $performance['calendar_year'];
            if (isset($performance['performance'][1]['taken'])) {
                $display_data[$row]['taken'] = $performance['performance'][1]['taken'];
                $display_data[$row]['cohort'] = $performance['performance'][1]['cohort'];
                $display_data[$row]['parts'] = question_info::display_parts($performance['performance'], $q_type);
                $display_data[$row]['p'] = question_info::display_p($performance['performance'], $q_type);
                $display_data[$row]['d'] = question_info::display_d($performance['performance'], $q_type);
            }
        }
    }
}
$sortby = 'calendar_year';
$ordering = 'asc';
$display_data = array_csort($display_data, $sortby, $ordering);
$row = 0;
foreach ($display_data as $display_line) {
    if ($display_line['q_id'] == $q_id) {
        echo "<tr style=\"font-weight:bold\">";
    } else {
        echo "<tr>";
    }
    echo "<td><img src=\"../artwork/" . $display_line['icon'] . "\" width=\"16\" height=\"16\" alt=\"icon\" /></td>";
    echo "<td><a href=\"\" onclick=\"loadPaper(" . $display_line['paperID'] . ")\">" . $display_line['title'] . "</a></td><td>" . $display_line['calendar_year'] . "</td>";
    echo "<td class=\"num\">" . $display_line['screen'] . "</td>";
    if (isset($display_line['taken'])) {
        echo "<td>" . $display_line['taken'] . "</td>";
        echo "<td class=\"num\">" . $display_line['cohort'] . "</td>";
        echo "<td class=\"num\">" . $display_line['parts'] . "</td>";
        echo "<td class=\"num\">" . $display_line['p'] . "</td>";
コード例 #17
0
ファイル: pfm.php プロジェクト: RangerWalt/ecci
function dir_list_form()
{
    global $fm_root_atual, $dir_atual, $quota_mb, $resolveIDs, $order_dir_list_by, $islinux, $cmd_name, $ip, $is_reachable, $path_info, $fm_color;
    $ti = getmicrotime();
    clearstatcache();
    $out = "<table border=0 cellspacing=1 cellpadding=4 width=\"100%\" bgcolor=\"#eeeeee\">\n";
    if ($opdir = @opendir($dir_atual)) {
        $entry_count = 0;
        $file_count = 0;
        $dir_count = 0;
        $total_size = 0;
        $uplink = "";
        $entry_list = array();
        $highlight_cols = 0;
        while ($file = readdir($opdir)) {
            if ($file != "." && $file != "..") {
                if (is_file($dir_atual . $file)) {
                    $ext = strtolower(strrchr($file, "."));
                    $entry_list[$entry_count]["type"] = "file";
                    // Função filetype() returns only "file"...
                    $entry_list[$entry_count]["size"] = filesize($dir_atual . $file);
                    $entry_list[$entry_count]["sizet"] = getsize($dir_atual . $file);
                    if (strstr($ext, ".")) {
                        $entry_list[$entry_count]["ext"] = $ext;
                        $entry_list[$entry_count]["extt"] = $ext;
                    } else {
                        $entry_list[$entry_count]["ext"] = "";
                        $entry_list[$entry_count]["extt"] = " ";
                    }
                    $file_count++;
                } elseif (is_dir($dir_atual . $file)) {
                    // Recursive directory size disabled
                    // $entry_list[$entry_count]["size"] = total_size($dir_atual.$file);
                    $entry_list[$entry_count]["size"] = 0;
                    $entry_list[$entry_count]["sizet"] = 0;
                    $entry_list[$entry_count]["type"] = "dir";
                    $dir_count++;
                }
                $entry_list[$entry_count]["name"] = $file;
                $entry_list[$entry_count]["date"] = date("Ymd", filemtime($dir_atual . $file));
                $entry_list[$entry_count]["time"] = date("his", filemtime($dir_atual . $file));
                $entry_list[$entry_count]["datet"] = date("d/m/Y h:i:s", filemtime($dir_atual . $file));
                if ($islinux && $resolveIDs) {
                    $entry_list[$entry_count]["p"] = show_perms(fileperms($dir_atual . $file));
                    $entry_list[$entry_count]["u"] = getuser(fileowner($dir_atual . $file));
                    $entry_list[$entry_count]["g"] = getgroup(filegroup($dir_atual . $file));
                } else {
                    $entry_list[$entry_count]["p"] = base_convert(fileperms($dir_atual . $file), 10, 8);
                    $entry_list[$entry_count]["p"] = substr($entry_list[$entry_count]["p"], strlen($entry_list[$entry_count]["p"]) - 3);
                    $entry_list[$entry_count]["u"] = fileowner($dir_atual . $file);
                    $entry_list[$entry_count]["g"] = filegroup($dir_atual . $file);
                }
                $total_size += $entry_list[$entry_count]["size"];
                $entry_count++;
            }
        }
        closedir($opdir);
        if ($file_count) {
            $highlight_cols = $islinux ? 7 : 5;
        } else {
            $highlight_cols = $islinux ? 6 : 4;
        }
        if ($entry_count) {
            $or1 = "1A";
            $or2 = "2D";
            $or3 = "3A";
            $or4 = "4A";
            $or5 = "5A";
            $or6 = "6D";
            $or7 = "7D";
            switch ($order_dir_list_by) {
                case "1A":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "name", SORT_STRING, SORT_ASC);
                    $or1 = "1D";
                    break;
                case "1D":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "name", SORT_STRING, SORT_DESC);
                    $or1 = "1A";
                    break;
                case "2A":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "p", SORT_STRING, SORT_ASC, "g", SORT_STRING, SORT_ASC, "u", SORT_STRING, SORT_ASC);
                    $or2 = "2D";
                    break;
                case "2D":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "p", SORT_STRING, SORT_DESC, "g", SORT_STRING, SORT_ASC, "u", SORT_STRING, SORT_ASC);
                    $or2 = "2A";
                    break;
                case "3A":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "u", SORT_STRING, SORT_ASC, "g", SORT_STRING, SORT_ASC);
                    $or3 = "3D";
                    break;
                case "3D":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "u", SORT_STRING, SORT_DESC, "g", SORT_STRING, SORT_ASC);
                    $or3 = "3A";
                    break;
                case "4A":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "g", SORT_STRING, SORT_ASC, "u", SORT_STRING, SORT_DESC);
                    $or4 = "4D";
                    break;
                case "4D":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "g", SORT_STRING, SORT_DESC, "u", SORT_STRING, SORT_DESC);
                    $or4 = "4A";
                    break;
                case "5A":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "size", SORT_NUMERIC, SORT_ASC);
                    $or5 = "5D";
                    break;
                case "5D":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "size", SORT_NUMERIC, SORT_DESC);
                    $or5 = "5A";
                    break;
                case "6A":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "date", SORT_STRING, SORT_ASC, "time", SORT_STRING, SORT_ASC, "name", SORT_STRING, SORT_ASC);
                    $or6 = "6D";
                    break;
                case "6D":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "date", SORT_STRING, SORT_DESC, "time", SORT_STRING, SORT_DESC, "name", SORT_STRING, SORT_ASC);
                    $or6 = "6A";
                    break;
                case "7A":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "ext", SORT_STRING, SORT_ASC, "name", SORT_STRING, SORT_ASC);
                    $or7 = "7D";
                    break;
                case "7D":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "ext", SORT_STRING, SORT_DESC, "name", SORT_STRING, SORT_ASC);
                    $or7 = "7A";
                    break;
            }
        }
        $out .= "\r\n        <script language=\"Javascript\" type=\"text/javascript\">\r\n        <!--\r\n        function getCookieVal (offset) {\r\n            var endstr = document.cookie.indexOf (';', offset);\r\n            if (endstr == -1) endstr = document.cookie.length;\r\n            return unescape(document.cookie.substring(offset, endstr));\r\n        }\r\n        function getCookie (name) {\r\n            var arg = name + '=';\r\n            var alen = arg.length;\r\n            var clen = document.cookie.length;\r\n            var i = 0;\r\n            while (i < clen) {\r\n                var j = i + alen;\r\n                if (document.cookie.substring(i, j) == arg) return getCookieVal (j);\r\n                i = document.cookie.indexOf(' ', i) + 1;\r\n                if (i == 0) break;\r\n            }\r\n            return null;\r\n        }\r\n        function setCookie (name, value) {\r\n            var argv = SetCookie.arguments;\r\n            var argc = SetCookie.arguments.length;\r\n            var expires = (argc > 2) ? argv[2] : null;\r\n            var path = (argc > 3) ? argv[3] : null;\r\n            var domain = (argc > 4) ? argv[4] : null;\r\n            var secure = (argc > 5) ? argv[5] : false;\r\n            document.cookie = name + '=' + escape (value) +\r\n            ((expires == null) ? '' : ('; expires=' + expires.toGMTString())) +\r\n            ((path == null) ? '' : ('; path=' + path)) +\r\n            ((domain == null) ? '' : ('; domain=' + domain)) +\r\n            ((secure == true) ? '; secure' : '');\r\n        }\r\n        function delCookie (name) {\r\n            var exp = new Date();\r\n            exp.setTime (exp.getTime() - 1);\r\n            var cval = GetCookie (name);\r\n            document.cookie = name + '=' + cval + '; expires=' + exp.toGMTString();\r\n        }\r\n        function go(arg) {\r\n            document.location.href='" . $path_info["basename"] . "?frame=3&dir_atual={$dir_atual}'+arg+'/';\r\n        }\r\n        function resolveIDs() {\r\n            document.location.href='" . $path_info["basename"] . "?frame=3&set_resolveIDs=1&dir_atual={$dir_atual}';\r\n        }\r\n        var entry_list = new Array();\r\n        // Custom object constructor\r\n        function entry(name, type, size, selected){\r\n            this.name = name;\r\n            this.type = type;\r\n            this.size = size;\r\n            this.selected = false;\r\n        }\r\n        // Declare entry_list for selection procedures";
        foreach ($entry_list as $i => $data) {
            $out .= "\nentry_list['entry{$i}'] = new entry('" . $data["name"] . "', '" . $data["type"] . "', " . $data["size"] . ", false);";
        }
        $out .= "\r\n        // Select/Unselect Rows OnClick/OnMouseOver\r\n        var lastRows = new Array(null,null);\r\n        function selectEntry(Row, Action){\r\n            var MarkColor = '#" . $fm_color['Mark'] . "';\r\n            var Cells = Row.getElementsByTagName('td');\r\n            if (multipleSelection){\r\n                // Avoid repeated onmouseover events from same Row ( cell transition )\r\n                if (Row != lastRows[0]){\r\n                    if (Action == 'over') {\r\n                        if (entry_list[Row.id].selected){\r\n                            if (entry_list[Row.id].type == 'dir') DefaultColor = '#" . $fm_color['Dir'] . "';\r\n                            else DefaultColor = '#" . $fm_color['File'] . "';\r\n                            if (unselect(entry_list[Row.id])) {\r\n                                for (var c=0; c < " . (int) $highlight_cols . "; c++) {\r\n                                    if (c == 0 && entry_list[Row.id].type=='file' && !entry_list[Row.id].selected) Cells[c].style.backgroundColor = '#" . $fm_color['FileFirstCell'] . "';\r\n                                    else Cells[c].style.backgroundColor = DefaultColor;\r\n                                }\r\n                            }\r\n                            // Change the last Row when you change the movement orientation\r\n                            if (lastRows[0] != null && lastRows[1] != null){\r\n                                var LastRowID = lastRows[0].id;\r\n                                var LastRowDefaultColor;\r\n                                if (entry_list[LastRowID].type == 'dir') LastRowDefaultColor = '#" . $fm_color['Dir'] . "';\r\n                                else LastRowDefaultColor = '#" . $fm_color['File'] . "';\r\n                                if (Row.id == lastRows[1].id){\r\n                                    var LastRowCells = lastRows[0].getElementsByTagName('td');\r\n                                    if (unselect(entry_list[LastRowID])) {\r\n                                        for (var c=0; c < " . (int) $highlight_cols . "; c++) {\r\n                                            if (c == 0 && entry_list[LastRowID].type=='file' && !entry_list[LastRowID].selected) LastRowCells[c].style.backgroundColor = '#" . $fm_color['FileFirstCell'] . "';\r\n                                            else LastRowCells[c].style.backgroundColor = LastRowDefaultColor;\r\n                                        }\r\n                                    }\r\n                                }\r\n                            }\r\n                        } else {\r\n                            if (select(entry_list[Row.id])){\r\n                                for (var c=0; c < " . (int) $highlight_cols . "; c++) {\r\n                                    if (c == 0 && entry_list[Row.id].type=='file' && !entry_list[Row.id].selected) Cells[c].style.backgroundColor = '#" . $fm_color['FileFirstCell'] . "';\r\n                                    else Cells[c].style.backgroundColor = MarkColor;\r\n                                }\r\n                            }\r\n                            // Change the last Row when you change the movement orientation\r\n                            if (lastRows[0] != null && lastRows[1] != null){\r\n                                var LastRowID = lastRows[0].id;\r\n                                if (Row.id == lastRows[1].id){\r\n                                    var LastRowCells = lastRows[0].getElementsByTagName('td');\r\n                                    if (select(entry_list[LastRowID])) {\r\n                                        for (var c=0; c < " . (int) $highlight_cols . "; c++) {\r\n                                            if (c == 0 && entry_list[LastRowID].type=='file' && !entry_list[LastRowID].selected) LastRowCells[c].style.backgroundColor = '#" . $fm_color['FileFirstCell'] . "';\r\n                                            else LastRowCells[c].style.backgroundColor = MarkColor;\r\n                                        }\r\n                                    }\r\n                                }\r\n                            }\r\n                        }\r\n                        lastRows[1] = lastRows[0];\r\n                        lastRows[0] = Row;\r\n                    }\r\n                }\r\n            } else {\r\n                if (Action == 'click') {\r\n                    var newColor = null;\r\n                    if (entry_list[Row.id].selected){\r\n                        var DefaultColor;\r\n                        if (entry_list[Row.id].type == 'dir') DefaultColor = '#" . $fm_color['Dir'] . "';\r\n                        else DefaultColor = '#" . $fm_color['File'] . "';\r\n                        if (unselect(entry_list[Row.id])) newColor = DefaultColor;\r\n                    } else {\r\n                        if (select(entry_list[Row.id])) newColor = MarkColor;\r\n                    }\r\n                    if (newColor) {\r\n                        lastRows[0] = lastRows[1] = Row;\r\n                        for (var c=0; c < " . (int) $highlight_cols . "; c++) {\r\n                            if (c == 0 && entry_list[Row.id].type=='file' && !entry_list[Row.id].selected) Cells[c].style.backgroundColor = '#" . $fm_color['FileFirstCell'] . "';\r\n                            else Cells[c].style.backgroundColor = newColor;\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n            return true;\r\n        }\r\n        // Disable text selection and bind multiple selection flag\r\n        var multipleSelection = false;\r\n        if (is.ie) {\r\n            document.onselectstart=new Function('return false');\r\n            document.onmousedown=switch_flag_on;\r\n            document.onmouseup=switch_flag_off;\r\n            // Event mouseup is not generated over scrollbar.. curiously, mousedown is.. go figure.\r\n            window.onscroll=new Function('multipleSelection=false');\r\n        } else {\r\n            if (document.layers) window.captureEvents(Event.MOUSEDOWN);\r\n            if (document.layers) window.captureEvents(Event.MOUSEUP);\r\n            window.onmousedown=switch_flag_on;\r\n            window.onmouseup=switch_flag_off;\r\n        }\r\n        // Using same function and a ternary operator couses bug on double click\r\n        function switch_flag_on(e) {\r\n            lastRows[0] = lastRows[1] = null;\r\n            if (is.ie){\r\n                multipleSelection = (event.button == 1);\r\n            } else {\r\n                multipleSelection = (e.which == 1);\r\n            }\r\n            return false;\r\n        }\r\n        function switch_flag_off(e) {\r\n            if (is.ie){\r\n                multipleSelection = (event.button != 1);\r\n            } else {\r\n                multipleSelection = (e.which != 1);\r\n            }\r\n            return false;\r\n        }\r\n        var total_dirs_selected = 0;\r\n        var total_files_selected = 0;\r\n        function unselect(Entry){\r\n            if (!Entry.selected) return false;\r\n            Entry.selected = false;\r\n            sel_totalsize -= Entry.size;\r\n            if (Entry.type == 'dir') total_dirs_selected--;\r\n            else total_files_selected--;\r\n            update_sel_status();\r\n            return true;\r\n        }\r\n        function select(Entry){\r\n            if(Entry.selected) return false;\r\n            Entry.selected = true;\r\n            sel_totalsize += Entry.size;\r\n            if(Entry.type == 'dir') total_dirs_selected++;\r\n            else total_files_selected++;\r\n            update_sel_status();\r\n            return true;\r\n        }\r\n        function is_anything_selected(){\r\n            var selected_dir_list = new Array();\r\n            var selected_file_list = new Array();\r\n            for(var x=0;x<" . (int) count($entry_list) . ";x++){\r\n                if(entry_list['entry'+x].selected){\r\n                    if(entry_list['entry'+x].type == 'dir') selected_dir_list.push(entry_list['entry'+x].name);\r\n                    else selected_file_list.push(entry_list['entry'+x].name);\r\n                }\r\n            }\r\n            document.form_action.selected_dir_list.value = selected_dir_list.join('<|*|>');\r\n            document.form_action.selected_file_list.value = selected_file_list.join('<|*|>');\r\n            return (total_dirs_selected>0 || total_files_selected>0);\r\n        }\r\n        function formatsize (arg) {\r\n            var resul = '';\r\n            if (arg>0){\r\n                var j = 0;\r\n                var ext = new Array(' bytes',' Kb',' Mb',' Gb',' Tb');\r\n                while (arg >= Math.pow(1024,j)) ++j;\r\n                resul = (Math.round(arg/Math.pow(1024,j-1)*100)/100) + ext[j-1];\r\n            } else resul = '0 Mb';\r\n            return resul;\r\n        }\r\n        var sel_totalsize = 0;\r\n        function update_sel_status(){\r\n            var t = total_dirs_selected+' " . et('Dir_s') . " " . et('And') . " '+total_files_selected+' " . et('File_s') . " " . et('Selected_s') . " = '+formatsize(sel_totalsize);\r\n            document.getElementById(\"sel_status\").innerHTML = t;\r\n        }\r\n        // Select all/none/inverse\r\n        function selectANI(Butt){\r\n            var MarkColor = '#" . $fm_color['Mark'] . "';\r\n            for(var x=0;x<" . (int) count($entry_list) . ";x++){\r\n                if (entry_list['entry'+x].type == 'dir'){\r\n                    var DefaultColor = '#" . $fm_color['Dir'] . "';\r\n                } else {\r\n                    var DefaultColor = '#" . $fm_color['File'] . "';\r\n                }\r\n                var Row = document.getElementById('entry'+x);\r\n                var Cells = Row.getElementsByTagName('td');\r\n                var newColor = null;\r\n                switch (Butt.value){\r\n                    case '" . et('SelAll') . "':\r\n                        if (select(entry_list[Row.id])) newColor = MarkColor;\r\n                    break;\r\n                    case '" . et('SelNone') . "':\r\n                        if (unselect(entry_list[Row.id])) newColor = DefaultColor;\r\n                    break;\r\n                    case '" . et('SelInverse') . "':\r\n                        if (entry_list[Row.id].selected){\r\n                            if (unselect(entry_list[Row.id])) newColor = DefaultColor;\r\n                        } else {\r\n                            if (select(entry_list[Row.id])) newColor = MarkColor;\r\n                        }\r\n                    break;\r\n                }\r\n                if (newColor) {\r\n                    for (var c=0; c < " . (int) $highlight_cols . "; c++) {\r\n                        if (entry_list[Row.id].type=='file' && c==0 && !entry_list[Row.id].selected) Cells[c].style.backgroundColor = '#" . $fm_color['FileFirstCell'] . "';\r\n                        else Cells[c].style.backgroundColor = newColor;\r\n                    }\r\n                }\r\n            }\r\n            if (Butt.value == '" . et('SelAll') . "'){\r\n                Butt.value = '" . et('SelNone') . "';\r\n            } else if (Butt.value == '" . et('SelNone') . "'){\r\n                Butt.value = '" . et('SelAll') . "';\r\n            }\r\n            return true;\r\n        }\r\n        function download(arg){\r\n                parent.frame1.location.href='" . $path_info["basename"] . "?action=3&dir_atual={$dir_atual}&filename='+escape(arg);\r\n        }\r\n        function upload(){\r\n                var w = 400;\r\n                var h = 200;\r\n                window.open('" . $path_info["basename"] . "?action=10&dir_atual={$dir_atual}', '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=no,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n        }\r\n        function execute(){\r\n                document.form_action.cmd_arg.value = prompt('" . et('TypeCmd') . ".');\r\n                if(document.form_action.cmd_arg.value.length>0){\r\n                    if(confirm('" . et('ConfExec') . " \\' '+document.form_action.cmd_arg.value+' \\' ?')) {\r\n                        var w = 800;\r\n                        var h = 600;\r\n                        window.open('" . $path_info["basename"] . "?action=6&dir_atual={$dir_atual}&cmd='+escape(document.form_action.cmd_arg.value), '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n                    }\r\n                }\r\n        }\r\n        function decompress(arg){\r\n                if(confirm('" . strtoupper(et('Decompress')) . " \\' '+arg+' \\' ?')) {\r\n                    document.form_action.action.value = 72;\r\n                    document.form_action.cmd_arg.value = arg;\r\n                    document.form_action.submit();\r\n                }\r\n        }\r\n        function edit_file(arg){\r\n                var w = 800;\r\n                var h = 600;\r\n                if(confirm('" . strtoupper(et('Edit')) . " \\' '+arg+' \\' ?')) window.open('" . $path_info["basename"] . "?action=7&dir_atual={$dir_atual}&filename='+escape(arg), '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=no,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n        }\r\n        function config(){\r\n                var w = 600;\r\n                var h = 400;\r\n                window.open('" . $path_info["basename"] . "?action=2', 'win_config', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n        }\r\n        function server_info(arg){\r\n                var w = 800;\r\n                var h = 600;\r\n                window.open('" . $path_info["basename"] . "?action=5', 'win_serverinfo', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n        }\r\n        function shell(){\r\n                var w = 800;\r\n                var h = 600;\r\n                window.open('" . $path_info["basename"] . "?action=9', '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n        }\r\n        function view(arg){\r\n                var w = 800;\r\n                var h = 600;\r\n                if(confirm('" . strtoupper(et('View')) . " \\' '+arg+' \\' ?')) window.open('" . $path_info["basename"] . "?action=4&dir_atual={$dir_atual}&filename='+escape(arg), '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=yes,toolbar=no,menubar=no,location=yes');\r\n        }\r\n        function rename(arg){\r\n                var nome = '';\r\n                if (nome = prompt('" . strtoupper(et('Ren')) . " \\' '+arg+' \\' " . et('To') . " ...')) document.location.href='" . $path_info["basename"] . "?frame=3&action=3&dir_atual={$dir_atual}&old_name='+escape(arg)+'&new_name='+escape(nome);\r\n        }\r\n        function set_dir_dest(arg){\r\n            document.form_action.dir_dest.value=arg;\r\n            if (document.form_action.action.value.length>0) test(document.form_action.action.value);\r\n            else alert('" . et('JSError') . ".');\r\n        }\r\n        function sel_dir(arg){\r\n            document.form_action.action.value = arg;\r\n            document.form_action.dir_dest.value='';\r\n            if (!is_anything_selected()) alert('" . et('NoSel') . ".');\r\n            else {\r\n                if (!getCookie('sel_dir_warn')) {\r\n                    alert('" . et('SelDir') . ".');\r\n                    document.cookie='sel_dir_warn'+'='+escape('true')+';';\r\n                }\r\n                parent.frame2.set_flag(true);\r\n            }\r\n        }\r\n        function set_chmod_arg(arg){\r\n            document.form_action.chmod_arg.value=arg;\r\n            if (document.form_action.action.value.length>0) test(document.form_action.action.value);\r\n            else alert('" . et('JSError') . "');\r\n        }\r\n        function chmod(arg){\r\n            document.form_action.action.value = arg;\r\n            document.form_action.dir_dest.value='';\r\n            document.form_action.chmod_arg.value='';\r\n            if (!is_anything_selected()) alert('" . et('NoSel') . ".');\r\n            else {\r\n                var w = 280;\r\n                var h = 180;\r\n                window.open('" . $path_info["basename"] . "?action=8', '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=no,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n            }\r\n        }\r\n        function test_action(){\r\n            if (document.form_action.action.value != 0) return true;\r\n            else return false;\r\n        }\r\n        function test_prompt(arg){\r\n                var erro='';\r\n                var conf='';\r\n                if (arg == 1){\r\n                    document.form_action.cmd_arg.value = prompt('" . et('TypeDir') . ".');\r\n                } else if (arg == 2){\r\n                    document.form_action.cmd_arg.value = prompt('" . et('TypeArq') . ".');\r\n                } else if (arg == 71){\r\n                    if (!is_anything_selected()) erro = '" . et('NoSel') . ".';\r\n                    else document.form_action.cmd_arg.value = prompt('" . et('TypeArqComp') . "');\r\n                }\r\n                if (erro!=''){\r\n                    document.form_action.cmd_arg.focus();\r\n                    alert(erro);\r\n                } else if(document.form_action.cmd_arg.value.length>0) {\r\n                    document.form_action.action.value = arg;\r\n                    document.form_action.submit();\r\n                }\r\n        }\r\n        function strstr(haystack,needle){\r\n            var index = haystack.indexOf(needle);\r\n            return (index==-1)?false:index;\r\n        }\r\n        function valid_dest(dest,orig){\r\n            return (strstr(dest,orig)==false)?true:false;\r\n        }\r\n        // ArrayAlert - Selection debug only\r\n        function aa(){\r\n            var str = 'selected_dir_list:\\n';\r\n            for (x=0;x<selected_dir_list.length;x++){\r\n                str += selected_dir_list[x]+'\\n';\r\n            }\r\n            str += '\\nselected_file_list:\\n';\r\n            for (x=0;x<selected_file_list.length;x++){\r\n                str += selected_file_list[x]+'\\n';\r\n            }\r\n            alert(str);\r\n        }\r\n        function test(arg){\r\n                var erro='';\r\n                var conf='';\r\n                if (arg == 4){\r\n                    if (!is_anything_selected()) erro = '" . et('NoSel') . ".\\n';\r\n                    conf = '" . et('RemSel') . " ?\\n';\r\n                } else if (arg == 5){\r\n                    if (!is_anything_selected()) erro = '" . et('NoSel') . ".\\n';\r\n                    else if(document.form_action.dir_dest.value.length == 0) erro = '" . et('NoDestDir') . ".';\r\n                    else if(document.form_action.dir_dest.value == document.form_action.dir_atual.value) erro = '" . et('DestEqOrig') . ".';\r\n                    else if(!valid_dest(document.form_action.dir_dest.value,document.form_action.dir_atual.value)) erro = '" . et('InvalidDest') . ".';\r\n                    conf = '" . et('CopyTo') . " \\' '+document.form_action.dir_dest.value+' \\' ?\\n';\r\n                } else if (arg == 6){\r\n                    if (!is_anything_selected()) erro = '" . et('NoSel') . ".';\r\n                    else if(document.form_action.dir_dest.value.length == 0) erro = '" . et('NoDestDir') . ".';\r\n                    else if(document.form_action.dir_dest.value == document.form_action.dir_atual.value) erro = '" . et('DestEqOrig') . ".';\r\n                    else if(!valid_dest(document.form_action.dir_dest.value,document.form_action.dir_atual.value)) erro = '" . et('InvalidDest') . ".';\r\n                    conf = '" . et('MoveTo') . " \\' '+document.form_action.dir_dest.value+' \\' ?\\n';\r\n                } else if (arg == 9){\r\n                    if (!is_anything_selected()) erro = '" . et('NoSel') . ".';\r\n                    else if(document.form_action.chmod_arg.value.length == 0) erro = '" . et('NoNewPerm') . ".';\r\n                    conf = '" . et('AlterPermTo') . " \\' '+document.form_action.chmod_arg.value+' \\' ?\\n';\r\n                }\r\n                if (erro!=''){\r\n                    document.form_action.cmd_arg.focus();\r\n                    alert(erro);\r\n                } else if(conf!='') {\r\n                    if(confirm(conf)) {\r\n                        document.form_action.action.value = arg;\r\n                        document.form_action.submit();\r\n                    }\r\n                } else {\r\n                    document.form_action.action.value = arg;\r\n                    document.form_action.submit();\r\n                }\r\n        }\r\n        //-->\r\n        </script>";
        $out .= "\r\n        <form name=\"form_action\" action=\"" . $path_info["basename"] . "\" method=\"post\" onsubmit=\"return test_action();\">\r\n            <input type=hidden name=\"frame\" value=3>\r\n            <input type=hidden name=\"action\" value=0>\r\n            <input type=hidden name=\"dir_dest\" value=\"\">\r\n            <input type=hidden name=\"chmod_arg\" value=\"\">\r\n            <input type=hidden name=\"cmd_arg\" value=\"\">\r\n            <input type=hidden name=\"dir_atual\" value=\"{$dir_atual}\">\r\n            <input type=hidden name=\"dir_antes\" value=\"{$dir_antes}\">\r\n            <input type=hidden name=\"selected_dir_list\" value=\"\">\r\n            <input type=hidden name=\"selected_file_list\" value=\"\">";
        $out .= "\r\n            <tr>\r\n            <td bgcolor=\"#DDDDDD\" colspan=20><nobr>\r\n            <input type=button onclick=\"config()\" value=\"" . et('Config') . "\">\r\n            <input type=button onclick=\"server_info()\" value=\"" . et('ServerInfo') . "\">\r\n            <input type=button onclick=\"test_prompt(1)\" value=\"" . et('CreateDir') . "\">\r\n            <input type=button onclick=\"test_prompt(2)\" value=\"" . et('CreateArq') . "\">\r\n            <input type=button onclick=\"execute()\" value=\"" . et('ExecCmd') . "\">\r\n            <input type=button onclick=\"upload()\" value=\"" . et('Upload') . "\">\r\n            <input type=button onclick=\"shell()\" value=\"" . et('Shell') . "\">\r\n            <b>{$ip}</b>\r\n            </nobr>";
        if ($dir_atual != $fm_root_atual) {
            $mat = explode("/", $dir_atual);
            $dir_antes = "";
            for ($x = 0; $x < count($mat) - 2; $x++) {
                $dir_antes .= $mat[$x] . "/";
            }
            $uplink = "<a href=\"" . $path_info["basename"] . "?frame=3&dir_atual={$dir_antes}\"><<</a> ";
        }
        if ($entry_count) {
            $out .= "\r\n                <tr><td bgcolor=\"#DDDDDD\" colspan=20><nobr>{$uplink} <a href=\"" . $path_info["basename"] . "?frame=3&dir_atual={$dir_atual}\">{$dir_atual}</a></nobr>\r\n                <tr>\r\n                <td bgcolor=\"#DDDDDD\" colspan=20><nobr>\r\n                      <input type=\"button\" style=\"width:60\" onclick=\"selectANI(this)\" value=\"" . et('SelAll') . "\">\r\n                      <input type=\"button\" style=\"width:60\" onclick=\"selectANI(this)\" value=\"" . et('SelInverse') . "\">\r\n                      <input type=\"button\" style=\"width:60\" onclick=\"test(4)\" value=\"" . et('Rem') . "\">\r\n                      <input type=\"button\" style=\"width:60\" onclick=\"sel_dir(5)\" value=\"" . et('Copy') . "\">\r\n                      <input type=\"button\" style=\"width:60\" onclick=\"sel_dir(6)\" value=\"" . et('Move') . "\">\r\n                      <input type=\"button\" style=\"width:100\" onclick=\"test_prompt(71)\" value=\"" . et('Compress') . "\">";
            if ($islinux) {
                $out .= "\r\n                      <input type=\"button\" style=\"width:100\" onclick=\"resolveIDs()\" value=\"" . et('ResolveIDs') . "\">";
            }
            $out .= "\r\n                      <input type=\"button\" style=\"width:100\" onclick=\"chmod(9)\" value=\"" . et('Perms') . "\">";
            $out .= "\r\n                </nobr>\r\n                <tr><td bgcolor=\"#DDDDDD\" colspan=20><DIV ID=\"sel_status\"></DIV></td></tr>";
            $dir_out = "";
            $file_out = "";
            foreach ($entry_list as $ind => $dir_entry) {
                $file = $dir_entry["name"];
                if ($dir_entry["type"] == "dir") {
                    $dir_out .= "\r\n                                 <tr ID=\"entry{$ind}\" onmouseover=\"selectEntry(this, 'over');\" onmousedown=\"selectEntry(this, 'click');\">\r\n                                 <td align=left bgcolor=\"#" . $fm_color['Dir'] . "\"><nobr><a href=\"JavaScript:go('{$file}')\">{$file}</a></nobr>\r\n                                 <td bgcolor=\"#" . $fm_color['Dir'] . "\">" . $dir_entry["p"];
                    if ($islinux) {
                        $dir_out .= "<td bgcolor=\"#" . $fm_color['Dir'] . "\">" . $dir_entry["u"] . "<td bgcolor=\"#" . $fm_color['Dir'] . "\">" . $dir_entry["g"];
                    }
                    $dir_out .= "\r\n                                 <td bgcolor=\"#" . $fm_color['Dir'] . "\">" . $dir_entry["sizet"] . "\r\n                                 <td bgcolor=\"#" . $fm_color['Dir'] . "\">" . $dir_entry["datet"];
                    if ($file_count) {
                        $dir_out .= "\r\n                                 <td bgcolor=\"#" . $fm_color['Dir'] . "\" align=center>";
                    }
                    // Opções de diretório
                    if (is_writable($dir_atual . $file)) {
                        $dir_out .= "\r\n                                 <td bgcolor=\"#FFFFFF\" align=center><a href=\"JavaScript:if(confirm('" . et('ConfRem') . " \\'" . $file . "\\' ?')) document.location.href='" . $path_info["basename"] . "?frame=3&action=8&cmd_arg=" . $file . "&dir_atual={$dir_atual}'\">" . et('Rem') . "</a>\r\n                                 <td bgcolor=\"#FFFFFF\" align=center><a href=\"JavaScript:rename('{$file}')\">" . et('Ren') . "</a>";
                    }
                    $dir_out .= "\r\n                                 </tr>";
                } else {
                    $file_out .= "\r\n                                 <tr ID=\"entry{$ind}\" onmouseover=\"selectEntry(this, 'over');\" onmousedown=\"selectEntry(this, 'click');\">\r\n                                 <td align=left bgcolor=\"#FFFFFF\"><nobr><a href=\"JavaScript:download('{$file}')\">{$file}</a></nobr>\r\n                                 <td bgcolor=\"#" . $fm_color['File'] . "\">" . $dir_entry["p"];
                    if ($islinux) {
                        $file_out .= "<td bgcolor=\"#" . $fm_color['File'] . "\">" . $dir_entry["u"] . "<td bgcolor=\"#" . $fm_color['File'] . "\">" . $dir_entry["g"];
                    }
                    $file_out .= "\r\n                                 <td bgcolor=\"#" . $fm_color['File'] . "\">" . $dir_entry["sizet"] . "\r\n                                 <td bgcolor=\"#" . $fm_color['File'] . "\">" . $dir_entry["datet"] . "\r\n                                 <td bgcolor=\"#" . $fm_color['File'] . "\">" . $dir_entry["extt"];
                    // Opções de arquivo
                    if (is_writable($dir_atual . $file)) {
                        $file_out .= "\r\n                                 <td bgcolor=\"#FFFFFF\" align=center><a href=\"javascript:if(confirm('" . strtoupper(et('Rem')) . " \\'" . $file . "\\' ?')) document.location.href='" . $path_info["basename"] . "?frame=3&action=8&cmd_arg=" . $file . "&dir_atual={$dir_atual}'\">" . et('Rem') . "</a>\r\n                                 <td bgcolor=\"#FFFFFF\" align=center><a href=\"javascript:rename('{$file}')\">" . et('Ren') . "</a>";
                    }
                    if (is_readable($dir_atual . $file) && strpos(".wav#.mp3#.mid#.avi#.mov#.mpeg#.mpg#.rm#.iso#.bin#.img#.dll#.psd#.fla#.swf#.class#.ppt#.jpg#.gif#.png#.wmf#.eps#.bmp#.msi#.exe#.com#.rar#.tar#.zip#.bz2#.tbz2#.bz#.tbz#.bzip#.gzip#.gz#.tgz#", $dir_entry["ext"] . "#") === false) {
                        $file_out .= "\r\n                                 <td bgcolor=\"#FFFFFF\" align=center><a href=\"javascript:edit_file('{$file}')\">" . et('Edit') . "</a>";
                    }
                    if (is_readable($dir_atual . $file) && strlen($dir_entry["ext"]) && strpos(".tar#.zip#.bz2#.tbz2#.bz#.tbz#.bzip#.gzip#.gz#.tgz#", $dir_entry["ext"] . "#") !== false) {
                        $file_out .= "\r\n                                 <td bgcolor=\"#FFFFFF\" align=center><a href=\"javascript:decompress('{$file}')\">" . et('Decompress') . "</a>";
                    }
                    if ($is_reachable && is_readable($dir_atual . $file) && strpos(".txt#.sys#.bat#.ini#.conf#.swf#.php#.php3#.asp#.html#.htm#.jpg#.gif#.png#.bmp#", $dir_entry["ext"] . "#") !== false) {
                        $file_out .= "\r\n                                 <td bgcolor=\"#FFFFFF\" align=center><a href=\"javascript:view('{$file}');\">" . et('View') . "</a>";
                    }
                    $file_out .= "</tr>";
                }
            }
            $out .= $dir_out;
            if ($entry_count) {
                $out .= "\r\n                <tr>\r\n                      <td bgcolor=\"#DDDDDD\"><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or1}&dir_atual={$dir_atual}\">" . et('Name') . "</a>\r\n                      <td bgcolor=\"#DDDDDD\"><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or2}&dir_atual={$dir_atual}\">" . et('Perms') . "</a>";
                if ($islinux) {
                    $out .= "<td bgcolor=\"#DDDDDD\"><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or3}&dir_atual={$dir_atual}\">" . et('Owner') . "</a><td bgcolor=\"#DDDDDD\"><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or4}&dir_atual={$dir_atual}\">" . et('Group') . "</a>";
                }
                $out .= "\r\n                      <td bgcolor=\"#DDDDDD\"><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or5}&dir_atual={$dir_atual}\">" . et('Size') . "</a>\r\n                      <td bgcolor=\"#DDDDDD\"><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or6}&dir_atual={$dir_atual}\">" . et('Date') . "</a>";
                if ($file_count) {
                    $out .= "\r\n                      <td bgcolor=\"#DDDDDD\"><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or7}&dir_atual={$dir_atual}\">" . et('Type') . "</a>";
                }
                $out .= "\r\n                      <td bgcolor=\"#DDDDDD\" colspan=20>";
            }
            $out .= $file_out;
            $out .= "\r\n                <tr>\r\n                <td bgcolor=\"#DDDDDD\" colspan=20><nobr>\r\n                      <input type=\"button\" style=\"width:60\" onclick=\"selectANI(this)\" value=\"" . et('SelAll') . "\">\r\n                      <input type=\"button\" style=\"width:60\" onclick=\"selectANI(this)\" value=\"" . et('SelInverse') . "\">\r\n                      <input type=\"button\" style=\"width:60\" onclick=\"test(4)\" value=\"" . et('Rem') . "\">\r\n                      <input type=\"button\" style=\"width:60\" onclick=\"sel_dir(5)\" value=\"" . et('Copy') . "\">\r\n                      <input type=\"button\" style=\"width:60\" onclick=\"sel_dir(6)\" value=\"" . et('Move') . "\">\r\n                      <input type=\"button\" style=\"width:100\" onclick=\"test_prompt(71)\" value=\"" . et('Compress') . "\">";
            if ($islinux) {
                $out .= "\r\n                      <input type=\"button\" style=\"width:100\" onclick=\"resolveIDs()\" value=\"" . et('ResolveIDs') . "\">";
            }
            $out .= "\r\n                      <input type=\"button\" style=\"width:100\" onclick=\"chmod(9)\" value=\"" . et('Perms') . "\">";
            $out .= "\r\n                </nobr></td>\r\n                </tr>";
            $out .= "\r\n            </form>";
            $out .= "\r\n                <tr><td bgcolor=\"#DDDDDD\" colspan=20>{$dir_count} " . et('Dir_s') . " " . et('And') . " {$file_count} " . et('File_s') . " = " . formatsize($total_size) . "</td></tr>";
            if ($quota_mb) {
                $out .= "\r\n                <tr><td bgcolor=\"#DDDDDD\" colspan=20>" . et('Partition') . ": " . formatsize($quota_mb * 1024 * 1024) . " " . et('Total') . " - " . formatsize($quota_mb * 1024 * 1024 - total_size($fm_root_atual)) . " " . et('Free') . "</td></tr>";
            } else {
                $out .= "\r\n                <tr><td bgcolor=\"#DDDDDD\" colspan=20>" . et('Partition') . ": " . formatsize(disk_total_space($dir_atual)) . " " . et('Total') . " - " . formatsize(disk_free_space($fm_root_atual)) . " " . et('Free') . "</td></tr>";
            }
            $tf = getmicrotime();
            $tt = $tf - $ti;
            $out .= "\r\n                <tr><td bgcolor=\"#DDDDDD\" colspan=20>" . et('RenderTime') . ": " . substr($tt, 0, strrpos($tt, ".") + 5) . " " . et('Seconds') . "</td></tr>";
            $out .= "\r\n            <script language=\"Javascript\" type=\"text/javascript\">\r\n            <!--\r\n                update_sel_status();\r\n            //-->\r\n            </script>";
        } else {
            $out .= "\r\n            <tr>\r\n            <td bgcolor=\"#DDDDDD\" width=\"1%\">{$uplink}<td bgcolor=\"#DDDDDD\" colspan=20><nobr><a href=\"" . $path_info["basename"] . "?frame=3&dir_atual={$dir_atual}\">{$dir_atual}</a></nobr>\r\n            <tr><td bgcolor=\"#DDDDDD\" colspan=20>" . et('EmptyDir') . ".</tr>";
        }
    } else {
        $out .= "<tr><td><font color=red>" . et('IOError') . ".<br>{$dir_atual}</font>";
    }
    $out .= "</table>";
    echo $out;
}
コード例 #18
0
ファイル: calendar.php プロジェクト: vinod-co/centa
    $paper_no++;
}
// Get metadata security
if (count($paper_ids) > 0) {
    $result = $mysqli->prepare('SELECT paperID, name, value FROM paper_metadata_security WHERE paperID IN (' . implode(',', $paper_ids) . ')');
    $result->execute();
    $result->bind_result($property_id, $metadata_name, $metadata_value);
    while ($result->fetch()) {
        $paper_details[$property_id]['metadata'][] = array('name' => $metadata_name, 'value' => $metadata_value);
    }
    $result->close();
}
// Sort all papers correctly by start time
$sortby = 'start_time';
$ordering = 'asc';
$paper_details = array_csort($paper_details, $sortby, $ordering);
$cellID = 0;
for ($i = 1; $i <= 12; $i++) {
    $current_full_month = date("m", mktime(0, 0, 0, $current_month, 1, $current_year));
    $days_in_month = date("t", mktime(0, 0, 0, $current_month, 1, $current_year));
    $paper_no = 0;
    echo "<div>";
    echo "<table class=\"monthgrid\">\n";
    $tmp_month = strtolower(date("F", mktime(0, 0, 0, $current_month, 1, $current_year)));
    echo "<tr><td class=\"month\"><a name=\"{$i}\"></a>" . $string[$tmp_month] . "</td></tr>\n";
    echo "<tr><td>";
    echo "<table style=\"width:100%; font-size:85%; margin-left:auto; margin-right:auto\">\n";
    echo "<tr><td class=\"dtext\">" . mb_substr($string['monday'], 0, 3, 'UTF-8') . "</td><td class=\"dtext\">" . mb_substr($string['tuesday'], 0, 3, 'UTF-8') . "</td><td class=\"dtext\">" . mb_substr($string['wednesday'], 0, 3, 'UTF-8') . "</td><td class=\"dtext\">" . mb_substr($string['thursday'], 0, 3, 'UTF-8') . "</td><td class=\"dtext\">" . mb_substr($string['friday'], 0, 3, 'UTF-8') . "</td></tr>";
    $day_no = 1;
    $cell_no = 1;
    $subtract = 0;
コード例 #19
0
ファイル: searchnew.php プロジェクト: alencarmo/OCF
/**
 * albumselect()
 *
 * return the HTML code for a listbox with name $id that contains the list
 * of all albums
 *
 * @param string $id the name of the listbox
 * @return the HTML code
 */
function albumselect($id = "album")
{
    // frogfoot re-wrote this function to present the list in categorized, sorted and nicely formatted order
    global $CONFIG, $lang_search_new_php, $cpg_udb;
    static $select = "";
    // Reset counter
    $list_count = 0;
    if ($select == "") {
        $result = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = 0");
        while ($row = mysql_fetch_array($result)) {
            // Add to multi-dim array for later sorting
            $listArray[$list_count]['cat'] = $lang_search_new_php['albums_no_category'];
            $listArray[$list_count]['aid'] = $row['aid'];
            $listArray[$list_count]['title'] = $row['title'];
            $list_count++;
        }
        mysql_free_result($result);
        $result = cpg_db_query("SELECT DISTINCT a.aid as aid, a.title as title, c.name as cname FROM {$CONFIG['TABLE_ALBUMS']} as a, {$CONFIG['TABLE_CATEGORIES']} as c WHERE a.category = c.cid AND a.category < '" . FIRST_USER_CAT . "'");
        while ($row = mysql_fetch_array($result)) {
            // Add to multi-dim array for later sorting
            $listArray[$list_count]['cat'] = $row['cname'];
            $listArray[$list_count]['aid'] = $row['aid'];
            $listArray[$list_count]['title'] = $row['title'];
            $list_count++;
        }
        mysql_free_result($result);
        //if (defined('UDB_INTEGRATION')) {
        $sql = $cpg_udb->get_batch_add_album_list();
        /*} else {
              $sql = "SELECT aid, CONCAT('(', user_name, ') ', title) AS title " . "FROM {$CONFIG['TABLE_ALBUMS']} AS a " . "INNER JOIN {$CONFIG['TABLE_USERS']} AS u ON category = (" . FIRST_USER_CAT . " + user_id)";
          }*/
        $result = cpg_db_query($sql);
        while ($row = mysql_fetch_array($result)) {
            // Add to multi-dim array for later sorting
            $listArray[$list_count]['cat'] = $lang_search_new_php['personal_albums'];
            $listArray[$list_count]['aid'] = $row['aid'];
            $listArray[$list_count]['title'] = $row['title'];
            $list_count++;
        }
        mysql_free_result($result);
        $select = '<option value="0">' . $lang_search_new_php['select_album'] . "</option>\n";
        // Sort the pulldown options by category and album name
        $listArray = array_csort($listArray, 'cat', 'title');
        // Create the nicely sorted and formatted drop down list
        $alb_cat = '';
        foreach ($listArray as $val) {
            if ($val['cat'] != $alb_cat) {
                if ($alb_cat) {
                    $select .= "</optgroup>\n";
                }
                $select .= '<optgroup label="' . $val['cat'] . '">' . "\n";
                $alb_cat = $val['cat'];
            }
            $select .= '<option value="' . $val['aid'] . '"' . ($val['aid'] == $sel_album ? ' selected' : '') . '>   ' . $val['title'] . "</option>\n";
        }
        if ($alb_cat) {
            $select .= "</optgroup>\n";
        }
    }
    return "\n<select name=\"{$id}\" class=\"listbox\">\n{$select}</select>\n";
}
コード例 #20
0
                    $objectives[$id]['chort_mark_sum'] = $chort_question_data[$q_id]['mark'];
                }
            }
            if ($objectives[$id]['totalpos_sum'] == 0) {
                $objectives[$id]['ratio'] = 0;
            } else {
                $objectives[$id]['ratio'] = $objectives[$id]['mark_sum'] / $objectives[$id]['totalpos_sum'];
            }
            if ($objectives[$id]['chort_totalpos_sum'] == 0) {
                $objectives[$id]['chort_ratio'] = 0;
            } else {
                $objectives[$id]['chort_ratio'] = $objectives[$id]['chort_mark_sum'] / $objectives[$id]['chort_totalpos_sum'];
            }
        }
    }
    $objectives = array_csort($objectives, 'ratio', 'desc');
}
if (count($objectives) == 0) {
    echo "<tr><td class=\"redwarn\" style=\"width:100%; height:30px; padding-left:10px\">" . $string['notmapped'] . "</td></tr></table>\n</body>\n</html>\n";
    exit;
}
echo "</table>\n";
// Display the feedback
?>
	<br />
  <h1><?php 
echo $string['learningobjectives'];
?>
</h1>
  <p style="line-height:150%; text-align:justify; margin-left:5%; margin-right:5%"><?php 
echo $string['explanation'];
コード例 #21
0
ファイル: summary_report.php プロジェクト: vinod-co/centa
        } else {
            $q_no = 1;
            foreach ($questions as $questionID => $tmp_data) {
                if (isset($user_data[0]['data'][$questionID][$student_userID])) {
                    $master_array[$user_number]["q{$q_no}"] = $user_data[0]['data'][$questionID][$student_userID];
                } else {
                    $master_array[$user_number]["q{$q_no}"] = '';
                }
                $q_no++;
            }
        }
        $user_number++;
    }
}
// Sort the data.
$master_array = array_csort($master_array, $sortby, $ordering);
for ($i = 0; $i < $user_number; $i++) {
    if ($master_array[$i]['student_id'] != '') {
        echo '<tr onclick="popMenu(2, event); setVars(' . $master_array[$i]['userid'] . ');">';
        echo '<td class="greyln col"><img src="../artwork/' . $master_array[$i]['icon'] . '" width="16" height="16" alt="" onclick="popMenu(2, event); setVars(' . $master_array[$i]['userid'] . ');" /></td>';
        echo '<td class="greyln col">' . $master_array[$i]['title'] . '</span></td>';
        echo '<td class="greyln col">' . $master_array[$i]['surname'] . '</span></td>';
        echo '<td class="greyln col">' . $master_array[$i]['first_names'] . '</td>';
        echo '<td class="greyln col">' . $master_array[$i]['student_id'] . '</td>';
        if ($master_array[$i]['have_review'] == 'Complete') {
            echo '<td class="greyln col">' . $string['Complete'] . '</td>';
        } else {
            echo '<td class="greyln col" style="color:#C00000">' . $string['Missing'] . '</td>';
        }
        echo '<td class="greyln col">' . $master_array[$i]['group'] . '</td>';
        if ($review_type == 1) {
コード例 #22
0
ファイル: upload.php プロジェクト: alencarmo/OCF
function form_alb_list_box($text, $name)
{
    // frogfoot re-wrote this function to present the list in categorized, sorted and nicely formatted order
    // Pull the $CONFIG array and the GET array into the function
    global $CONFIG, $lang_upload_php;
    // Also pull the album lists into the function
    global $user_albums_list, $public_albums_list;
    // Check to see if an album has been preselected by URL addition. If so, make $sel_album the album number. Otherwise, make $sel_album 0.
    $sel_album = isset($_GET['album']) ? $_GET['album'] : 0;
    // Create the opening of the drop down box
    echo <<<EOT
    <tr>
        <td class="tableb">
            {$text}
        </td>
        <td class="tableb" valign="top">
            <select name="{$name}" class="listbox">

EOT;
    // Reset counter
    $list_count = 0;
    // Cycle through the User albums
    foreach ($user_albums_list as $album) {
        // Add to multi-dim array for later sorting
        $listArray[$list_count]['cat'] = $lang_upload_php['personal_albums'];
        $listArray[$list_count]['aid'] = $album['aid'];
        $listArray[$list_count]['title'] = $album['title'];
        $list_count++;
    }
    // Cycle through the public albums
    foreach ($public_albums_list as $album) {
        // Set $album_id to the actual album ID
        $album_id = $album['aid'];
        // Get the category name
        $vQuery = "SELECT cat.name FROM " . $CONFIG['TABLE_CATEGORIES'] . " cat, " . $CONFIG['TABLE_ALBUMS'] . " alb WHERE alb.aid='" . $album_id . "' AND cat.cid=alb.category";
        $vRes = cpg_db_query($vQuery);
        $vRes = mysql_fetch_array($vRes);
        // Add to multi-dim array for sorting later
        if ($vRes['name']) {
            $listArray[$list_count]['cat'] = $vRes['name'];
        } else {
            $listArray[$list_count]['cat'] = $lang_upload_php['albums_no_category'];
        }
        $listArray[$list_count]['aid'] = $album['aid'];
        $listArray[$list_count]['title'] = $album['title'];
        $list_count++;
    }
    // Sort the pulldown options by category and album name
    $listArray = array_csort($listArray, 'cat', 'title');
    // Finally, print out the nicely sorted and formatted drop down list
    $alb_cat = '';
    echo '                <option value="">' . $lang_upload_php['select_album'] . "</option>\n";
    foreach ($listArray as $val) {
        if ($val['cat'] != $alb_cat) {
            if ($alb_cat) {
                echo "                </optgroup>\n";
            }
            echo '                <optgroup label="' . $val['cat'] . '">' . "\n";
            $alb_cat = $val['cat'];
        }
        echo '                <option value="' . $val['aid'] . '"' . ($val['aid'] == $sel_album ? ' selected' : '') . '>   ' . $val['title'] . "</option>\n";
    }
    if ($alb_cat) {
        echo "                </optgroup>\n";
    }
    // Close the drop down
    echo <<<EOT
            </select>
        </td>
    </tr>

EOT;
}
コード例 #23
0
ファイル: view.wizard.php プロジェクト: MexinaD/SuiteCRM
 /**
  * Function to sort currencies in array alphabetically, except for US Dollar which must remain as first element
  * in the array.
  *
  * @param array $currenciesArray Array of currencies to sort
  * @return array|string Array of sorted currencies with the US Dollar as the first
  */
 public function correctCurrenciesSymbolsSort($currenciesArray)
 {
     $baseCurrencyId = '-99';
     $newCurrenciesArray = array();
     $newCurrenciesArray[] = $currenciesArray[$baseCurrencyId]['symbol'];
     array_shift($currenciesArray);
     $currenciesArray = array_csort($currenciesArray);
     foreach ($currenciesArray as $value) {
         $newCurrenciesArray[] = $value['symbol'];
     }
     return $this->pushCurrencyArrayToString($newCurrenciesArray);
 }
コード例 #24
0
ファイル: assessment_boolean.php プロジェクト: vinod-co/centa
     $log_array[$rowID]['year'] = $year;
     $log_array[$rowID]['started'] = $started;
     $log_array[$rowID]['title'] = $title;
     $log_array[$rowID]['surname'] = demo_replace($surname, $demo);
     $log_array[$rowID]['first_names'] = demo_replace($first_names, $demo);
     $log_array[$rowID]['name'] = str_replace("'", "", $surname) . ',' . $first_names;
     $log_array[$rowID]['gender'] = $gender;
     $log_array[$rowID]['$questionID'] = json_decode($settings, true);
     $user_no++;
     $old_username = $username;
     $old_started = $started;
 }
 $result->close();
 $sortby = 'name';
 $ordering = 'asc';
 $log_array = array_csort($log_array, $sortby, $ordering);
 //********************************
 $exclusions = new Exclusion($paperID, $mysqli);
 $exclusions->load();
 // Get any questions to exclude.
 $row_written = 0;
 foreach ($user_results as $individual) {
     $tmp_user_ID = $individual['username'];
     // Write out the headings.
     if ($row_written == 0) {
         // Only output personal data if assessment, do not show if survey.
         if ($paper_type < 3) {
             $csv .= '"' . $string['gender'] . '","' . $string['title'] . '","' . $string['surname'] . '","' . $string['firstnames'] . '","' . $string['studentid'] . '","' . $string['course'] . '","' . $string['year'] . '","' . $string['submitted'] . '"';
         } else {
             $csv .= '"' . $string['gender'] . '","' . $string['course'] . '","' . $string['year'] . '","' . $string['submitted'] . '"';
         }
コード例 #25
0
?>
</th>
            <?php 
if (w2PgetConfig('direct_edit_assignment')) {
    ?>
<th width="0">&nbsp;</th><?php 
}
?>
        </tr>
        <?php 
// sorting tasks
if ($task_sort_item1 != '') {
    if ($task_sort_item2 != '' && $task_sort_item1 != $task_sort_item2) {
        $tasks = array_csort($tasks, $task_sort_item1, $task_sort_order1, $task_sort_type1, $task_sort_item2, $task_sort_order2, $task_sort_type2);
    } else {
        $tasks = array_csort($tasks, $task_sort_item1, $task_sort_order1, $task_sort_type1);
    }
} else {
    // All this appears to already be handled in todo.php ... should consider deleting this else block
    /* we have to calculate the end_date via start_date+duration for
     ** end='0000-00-00 00:00:00' if array_csort function is not used
     ** as it is normally done in array_csort function in order to economise
     ** cpu time as we have to go through the array there anyway
     */
    for ($j = 0, $j_cmp = count($tasks); $j < $j_cmp; $j++) {
        if ($tasks[$j]['task_end_date'] == '0000-00-00 00:00:00' || $tasks[$j]['task_end_date'] == '') {
            if ($tasks[$j]['task_start_date'] == '0000-00-00 00:00:00' || $tasks[$j]['task_start_date'] == '') {
                $tasks[$j]['task_start_date'] = '0000-00-00 00:00:00';
                //just to be sure start date is "zeroed"
                $tasks[$j]['task_end_date'] = '0000-00-00 00:00:00';
            } else {
コード例 #26
0
ファイル: ldaplookup.php プロジェクト: vinod-co/centa
             $user_data[$user]['role'] = $object->role;
         } else {
             $user_data[$user]['role'] = '';
         }
         if (isset($object->school)) {
             $user_data[$user]['school'] = $object->school;
         } else {
             $user_data[$user]['school'] = '';
         }
         $user_data[$user]['key'] = $key;
         $user_data[$user]['object'] = $object;
         $user++;
     }
 }
 if ($user > 1) {
     $user_data = array_csort($user_data, 'first_names', 'asc');
 }
 unset($_SESSION['ldaplookupdata']);
 for ($i = 0; $i < $user; $i++) {
     $title = $user_data[$i]['title'];
     $first_names = $user_data[$i]['first_names'];
     $surname = $user_data[$i]['surname'];
     $username = $user_data[$i]['username'];
     $email = $user_data[$i]['email'];
     $school = $user_data[$i]['school'];
     $role = $user_data[$i]['role'];
     $key = $user_data[$i]['key'];
     $object = $user_data[$i]['object'];
     $_SESSION['ldaplookup'][$i] = $key;
     $_SESSION['ldaplookupdata'][$key] = $object;
     echo "<tr class=\"l\" id=\"{$key}\"><td>{$title}</td><td>{$first_names}</td><td>{$surname}</td><td>{$username}</td><td>{$email}</td><td>{$role}</td></tr>\n";
コード例 #27
0
ファイル: Popup_picker.php プロジェクト: klr2003/sourceread
 /**
  *
  */
 function process_page()
 {
     global $focus;
     global $mod_strings;
     global $app_strings;
     global $app_list_strings;
     global $currentModule;
     global $odd_bg;
     global $even_bg;
     global $timedate;
     $history_list = array();
     if (!empty($_REQUEST['record'])) {
         $result = $focus->retrieve($_REQUEST['record']);
         if ($result == null) {
             sugar_die($app_strings['ERROR_NO_RECORD']);
         }
     }
     $activitiesRels = array('tasks' => 'Task', 'meetings' => 'Meeting', 'calls' => 'Call', 'emails' => 'Email', 'notes' => 'Note');
     //Setup the arrays to store the linked records.
     foreach ($activitiesRels as $relMod => $beanName) {
         $varname = "focus_" . $relMod . "_list";
         ${$varname} = array();
     }
     foreach ($focus->get_linked_fields() as $field => $def) {
         if ($focus->load_relationship($field)) {
             $relTable = $focus->{$field}->getRelatedTableName();
             if (in_array($relTable, array_keys($activitiesRels))) {
                 $varname = "focus_" . $relTable . "_list";
                 ${$varname} = sugarArrayMerge(${$varname}, $focus->get_linked_beans($field, $activitiesRels[$relTable]));
             }
         }
     }
     foreach ($focus_tasks_list as $task) {
         $sort_date_time = '';
         if ($task->date_due == '0000-00-00') {
             $date_due = '';
         } else {
             $date_due = $task->date_due;
         }
         if (!empty($task->date_due) and !empty($task->time_due)) {
             $sort_date_time = $timedate->to_db_date_time($task->date_due, $task->time_due);
             $sort_date_time = implode(' ', $sort_date_time);
             // kbrill - Bug #16714
             //$sort_date_time=$timedate->handle_offset($sort_date_time,'Y-m-d H:i:s',true);
         }
         if ($task->status != "Not Started" && $task->status != "In Progress" && $task->status != "Pending Input") {
             $history_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_modified' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE'], 'sort_value' => $sort_date_time);
         } else {
             $open_activity_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_due' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE']);
         }
     }
     // end Tasks
     foreach ($focus_meetings_list as $meeting) {
         if ($meeting->status != "Planned") {
             $sort_date_time = '';
             if (!empty($meeting->date_start) and !empty($meeting->time_start)) {
                 $sort_date_time = $timedate->to_db_date_time($meeting->date_start, $meeting->time_start);
                 $sort_date_time = implode(' ', $sort_date_time);
                 // kbrill - Bug #16714
                 //$sort_date_time=$timedate->handle_offset($sort_date_time,'Y-m-d H:i:s',true);
             }
             $history_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_modified' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => $sort_date_time);
         } else {
             $open_activity_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_due' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START']);
         }
     }
     // end Meetings
     foreach ($focus_calls_list as $call) {
         if ($call->status != "Planned") {
             $sort_date_time = '';
             if (!empty($call->date_start) and !empty($call->time_start)) {
                 $sort_date_time = $timedate->to_db_date_time($call->date_start, $call->time_start);
                 $sort_date_time = implode(' ', $sort_date_time);
                 // kbrill - Bug #16714
                 //$sort_date_time=$timedate->handle_offset($sort_date_time,'Y-m-d H:i:s',true);
             } elseif (!empty($call->date_start) && empty($call->time_start)) {
                 //jc - Bug#19862
                 //for some reason the calls module does not populate the time_start variable in
                 //this case, so the date_start attribute contains the information we need
                 //to determine where in the history this call belongs.
                 //using swap_formats to get from the format '03/31/2008 09:45pm' to the format
                 //'2008-03-31 09:45:00'
                 $sort_date_time = $timedate->swap_formats($call->date_start, $timedate->get_date_time_format(), $timedate->get_db_date_time_format());
             }
             $history_list[] = array('name' => $call->name, 'id' => $call->id, 'type' => "Call", 'direction' => $call->direction, 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_modified' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => $sort_date_time);
         } else {
             $open_activity_list[] = array('name' => $call->name, 'id' => $call->id, 'direction' => $call->direction, 'type' => "Call", 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_due' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START']);
         }
     }
     // end Calls
     foreach ($focus_emails_list as $email) {
         $sort_date_time = '';
         if (!empty($email->date_start) and !empty($email->time_start)) {
             $sort_date_time = $timedate->to_db_date_time($email->date_start, $email->time_start);
             $sort_date_time = implode(' ', $sort_date_time);
             // kbrill - Bug #16714
             //$sort_date_time=$timedate->handle_offset($sort_date_time,'Y-m-d H:i:s',true);
         }
         $history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => $sort_date_time);
     }
     //end Emails
     foreach ($focus_notes_list as $note) {
         if (!empty($note->date_modified)) {
             $sort_date_time = $timedate->swap_formats($note->date_modified, $timedate->get_date_time_format(), $timedate->get_db_date_time_format());
         }
         $history_list[] = array('name' => $note->name, 'id' => $note->id, 'type' => "Note", 'direction' => '', 'module' => "Notes", 'status' => '', 'parent_id' => $note->parent_id, 'parent_type' => $note->parent_type, 'parent_name' => $note->parent_name, 'contact_id' => $note->contact_id, 'contact_name' => $note->contact_name, 'date_modified' => $note->date_modified, 'description' => $this->formatDescription($note->description), 'date_type' => $app_strings['DATA_TYPE_MODIFIED'], 'sort_value' => $sort_date_time);
         if (!empty($note->filename)) {
             $count = count($history_list);
             $count--;
             $history_list[$count]['filename'] = $note->filename;
             $history_list[$count]['fileurl'] = UploadFile::get_url($note->filename, $note->id);
         }
     }
     // end Notes
     $xtpl = new XTemplate('modules/Activities/Popup_picker.html');
     $xtpl->assign('MOD', $mod_strings);
     $xtpl->assign('APP', $app_strings);
     insert_popup_header();
     //output header
     echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>";
     echo get_module_title($focus->module_dir, translate('LBL_MODULE_NAME', $focus->module_dir) . ": " . $focus->name, false);
     echo "</td><td align='right' class='moduleTitle'>";
     echo "<A href='javascript:print();' class='utilsLink'><img src='" . SugarThemeRegistry::current()->getImageURL("print.gif") . "' width='13' height='13' alt='" . $app_strings['LNK_PRINT'] . "' border='0' align='absmiddle'></a>&nbsp;<A href='javascript:print();' class='utilsLink'>" . $app_strings['LNK_PRINT'] . "</A>\n";
     echo "</td></tr></table>";
     $oddRow = true;
     if (count($history_list) > 0) {
         $history_list = array_csort($history_list, 'sort_value', SORT_DESC);
     }
     foreach ($history_list as $activity) {
         $activity_fields = array('ID' => $activity['id'], 'NAME' => $activity['name'], 'MODULE' => $activity['module'], 'CONTACT_NAME' => $activity['contact_name'], 'CONTACT_ID' => $activity['contact_id'], 'PARENT_TYPE' => $activity['parent_type'], 'PARENT_NAME' => $activity['parent_name'], 'PARENT_ID' => $activity['parent_id'], 'DATE' => $activity['date_modified'], 'DESCRIPTION' => $activity['description'], 'DATE_TYPE' => $activity['date_type']);
         if (empty($activity['direction'])) {
             $activity_fields['TYPE'] = $app_list_strings['activity_dom'][$activity['type']];
         } else {
             $activity_fields['TYPE'] = $app_list_strings['call_direction_dom'][$activity['direction']] . ' ' . $app_list_strings['activity_dom'][$activity['type']];
         }
         switch ($activity['type']) {
             case 'Call':
                 $activity_fields['STATUS'] = $app_list_strings['call_status_dom'][$activity['status']];
                 break;
             case 'Meeting':
                 $activity_fields['STATUS'] = $app_list_strings['meeting_status_dom'][$activity['status']];
                 break;
             case 'Task':
                 $activity_fields['STATUS'] = $app_list_strings['task_status_dom'][$activity['status']];
                 break;
         }
         if (isset($activity['location'])) {
             $activity_fields['LOCATION'] = $activity['location'];
         }
         if (isset($activity['filename'])) {
             $activity_fields['ATTACHMENT'] = "<a href='index.php?entryPoint=download&id=" . $activity['id'] . "&type=Notes' target='_blank'>" . SugarThemeRegistry::current()->getImage("attachment", "alt='" . $activity['filename'] . "' border='0' align='absmiddle'") . "</a>";
         }
         if (isset($activity['parent_type'])) {
             $activity_fields['PARENT_MODULE'] = $activity['parent_type'];
         }
         $xtpl->assign("ACTIVITY", $activity_fields);
         $xtpl->assign("ACTIVITY_MODULE_PNG", SugarThemeRegistry::current()->getImage($activity_fields['MODULE'] . '', 'border="0" alt="' . $activity_fields['NAME'] . '"'));
         if ($oddRow) {
             //todo move to themes
             $xtpl->assign("ROW_COLOR", 'oddListRow');
             $xtpl->assign("BG_COLOR", $odd_bg);
         } else {
             //todo move to themes
             $xtpl->assign("ROW_COLOR", 'evenListRow');
             $xtpl->assign("BG_COLOR", $even_bg);
         }
         $oddRow = !$oddRow;
         $xtpl->parse("history.row");
         // Put the rows in.
     }
     $xtpl->parse("history");
     $xtpl->out("history");
     insert_popup_footer();
 }
コード例 #28
0
function alb_list_box()
{
    global $CONFIG, $CLEAN, $cpg_udb, $CPG_PHP_SELF, $lang_modifyalb_php, $LINEBREAK;
    $rowset = array();
    if (GALLERY_ADMIN_MODE) {
        $result = cpg_db_query("SELECT a.aid, a.title, c.name FROM {$CONFIG['TABLE_ALBUMS']} AS a INNER JOIN {$CONFIG['TABLE_CATEGORIES']} AS c ON a.category = c.cid WHERE a.category < '" . FIRST_USER_CAT . "'");
        while ($row = mysql_fetch_assoc($result)) {
            // Add to multi-dim array for later sorting
            $rowset[] = array('cat' => $row['name'], 'aid' => $row['aid'], 'title' => $row['title']);
        }
        mysql_free_result($result);
        //now we need to select the albums without a category
        $result = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = 0");
        while ($row = mysql_fetch_assoc($result)) {
            // Add to multi-dim array for later sorting
            $rowset[] = array('cat' => $lang_modifyalb_php['no_cat'], 'aid' => $row['aid'], 'title' => $row['title']);
        }
        mysql_free_result($result);
        $sql = $cpg_udb->get_admin_album_list();
        $result = cpg_db_query($sql);
        while ($row = mysql_fetch_assoc($result)) {
            // Add to multi-dim array for later sorting
            $rowset[] = array('cat' => $lang_modifyalb_php['user_gal'], 'aid' => $row['aid'], 'title' => $row['title']);
        }
        mysql_free_result($result);
    } else {
        //Only list the albums owned by the user
        //get albums in "my albums"
        $result = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = " . (USER_ID + FIRST_USER_CAT) . " AND owner = " . USER_ID);
        while ($row = mysql_fetch_assoc($result)) {
            // Add to multi-dim array for later sorting
            $rowset[] = array('cat' => $lang_modifyalb_php['my_gal'], 'aid' => $row['aid'], 'title' => $row['title']);
        }
        mysql_free_result($result);
        //get public albums
        $result = cpg_db_query("SELECT a.aid, a.title, c.name FROM {$CONFIG['TABLE_ALBUMS']} AS a INNER JOIN {$CONFIG['TABLE_CATEGORIES']} AS c ON a.category = c.cid WHERE a.owner = " . USER_ID);
        while ($row = mysql_fetch_assoc($result)) {
            // Add to multi-dim array for later sorting
            $rowset[] = array('cat' => $row['name'], 'aid' => $row['aid'], 'title' => $row['title']);
        }
        mysql_free_result($result);
        //now we need to select the albums without a category
        $result = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = 0 AND owner = " . USER_ID);
        while ($row = mysql_fetch_assoc($result)) {
            // Add to multi-dim array for later sorting
            $rowset[] = array('cat' => $lang_modifyalb_php['no_cat'], 'aid' => $row['aid'], 'title' => $row['title']);
        }
        mysql_free_result($result);
    }
    // Sort by category and album title
    $rowset = array_csort($rowset, 'cat', 'title');
    if (count($rowset)) {
        // Create the nicely sorted and formatted drop down list
        $alb_cat = '';
        $select = "<select name=\"album_listbox\" class=\"listbox\" onchange=\"if(this.options[this.selectedIndex].value) window.location.href='{$CPG_PHP_SELF}?album='+this.options[this.selectedIndex].value;\">" . $LINEBREAK;
        foreach ($rowset as $val) {
            if ($val['cat'] != $alb_cat) {
                if ($alb_cat) {
                    $select .= '</optgroup>' . $LINEBREAK;
                }
                $select .= '<optgroup label="' . $val['cat'] . '">' . $LINEBREAK;
                $alb_cat = $val['cat'];
            }
            $select .= '<option value="' . $val['aid'] . '"' . ($val['aid'] == $CLEAN['album'] ? ' selected="selected"' : '') . '>   ' . $val['title'] . '</option>' . $LINEBREAK;
        }
        if ($alb_cat) {
            $select .= '</optgroup>' . $LINEBREAK;
        }
        $select .= '</select>' . $LINEBREAK;
        return $select;
    }
}
コード例 #29
0
ファイル: index.php プロジェクト: Kavir91/Convocatoria
function dir_list_form()
{
    global $fm_current_root, $current_dir, $quota_mb, $resolveIDs, $order_dir_list_by, $islinux, $cmd_name, $ip, $path_info, $fm_color;
    $ti = getmicrotime();
    clearstatcache();
    $out = "<table border=0 cellspacing=1 cellpadding=4 width=\"100%\" bgcolor=\"#eeeeee\">\n";
    if ($opdir = @opendir($current_dir)) {
        $has_files = false;
        $entry_count = 0;
        $total_size = 0;
        $entry_list = array();
        while ($file = readdir($opdir)) {
            if ($file != "." && $file != "..") {
                $entry_list[$entry_count]["size"] = 0;
                $entry_list[$entry_count]["sizet"] = 0;
                $entry_list[$entry_count]["type"] = "none";
                if (is_file($current_dir . $file)) {
                    $ext = lowercase(strrchr($file, "."));
                    $entry_list[$entry_count]["type"] = "file";
                    // Função filetype() returns only "file"...
                    $entry_list[$entry_count]["size"] = filesize($current_dir . $file);
                    $entry_list[$entry_count]["sizet"] = format_size($entry_list[$entry_count]["size"]);
                    if (strstr($ext, ".")) {
                        $entry_list[$entry_count]["ext"] = $ext;
                        $entry_list[$entry_count]["extt"] = $ext;
                    } else {
                        $entry_list[$entry_count]["ext"] = "";
                        $entry_list[$entry_count]["extt"] = "&nbsp;";
                    }
                    $has_files = true;
                } elseif (is_dir($current_dir . $file)) {
                    // Recursive directory size disabled
                    // $entry_list[$entry_count]["size"] = total_size($current_dir.$file);
                    $entry_list[$entry_count]["size"] = 0;
                    $entry_list[$entry_count]["sizet"] = "&nbsp;";
                    $entry_list[$entry_count]["type"] = "dir";
                }
                $entry_list[$entry_count]["name"] = $file;
                $entry_list[$entry_count]["date"] = date("Ymd", filemtime($current_dir . $file));
                $entry_list[$entry_count]["time"] = date("his", filemtime($current_dir . $file));
                $entry_list[$entry_count]["datet"] = date("d/m/y h:i", filemtime($current_dir . $file));
                if ($islinux && $resolveIDs) {
                    $entry_list[$entry_count]["p"] = show_perms(fileperms($current_dir . $file));
                    $entry_list[$entry_count]["u"] = get_user(fileowner($current_dir . $file));
                    $entry_list[$entry_count]["g"] = get_group(filegroup($current_dir . $file));
                } else {
                    $entry_list[$entry_count]["p"] = base_convert(fileperms($current_dir . $file), 10, 8);
                    $entry_list[$entry_count]["p"] = substr($entry_list[$entry_count]["p"], strlen($entry_list[$entry_count]["p"]) - 3);
                    $entry_list[$entry_count]["u"] = fileowner($current_dir . $file);
                    $entry_list[$entry_count]["g"] = filegroup($current_dir . $file);
                }
                $total_size += $entry_list[$entry_count]["size"];
                $entry_count++;
            }
        }
        @closedir($opdir);
        if ($entry_count) {
            $or1 = "1A";
            $or2 = "2D";
            $or3 = "3A";
            $or4 = "4A";
            $or5 = "5A";
            $or6 = "6D";
            $or7 = "7D";
            switch ($order_dir_list_by) {
                case "1A":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "name", SORT_STRING, SORT_ASC);
                    $or1 = "1D";
                    break;
                case "1D":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "name", SORT_STRING, SORT_DESC);
                    $or1 = "1A";
                    break;
                case "2A":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "p", SORT_STRING, SORT_ASC, "g", SORT_STRING, SORT_ASC, "u", SORT_STRING, SORT_ASC);
                    $or2 = "2D";
                    break;
                case "2D":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "p", SORT_STRING, SORT_DESC, "g", SORT_STRING, SORT_ASC, "u", SORT_STRING, SORT_ASC);
                    $or2 = "2A";
                    break;
                case "3A":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "u", SORT_STRING, SORT_ASC, "g", SORT_STRING, SORT_ASC);
                    $or3 = "3D";
                    break;
                case "3D":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "u", SORT_STRING, SORT_DESC, "g", SORT_STRING, SORT_ASC);
                    $or3 = "3A";
                    break;
                case "4A":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "g", SORT_STRING, SORT_ASC, "u", SORT_STRING, SORT_DESC);
                    $or4 = "4D";
                    break;
                case "4D":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "g", SORT_STRING, SORT_DESC, "u", SORT_STRING, SORT_DESC);
                    $or4 = "4A";
                    break;
                case "5A":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "size", SORT_NUMERIC, SORT_ASC);
                    $or5 = "5D";
                    break;
                case "5D":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "size", SORT_NUMERIC, SORT_DESC);
                    $or5 = "5A";
                    break;
                case "6A":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "date", SORT_STRING, SORT_ASC, "time", SORT_STRING, SORT_ASC, "name", SORT_STRING, SORT_ASC);
                    $or6 = "6D";
                    break;
                case "6D":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "date", SORT_STRING, SORT_DESC, "time", SORT_STRING, SORT_DESC, "name", SORT_STRING, SORT_ASC);
                    $or6 = "6A";
                    break;
                case "7A":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "ext", SORT_STRING, SORT_ASC, "name", SORT_STRING, SORT_ASC);
                    $or7 = "7D";
                    break;
                case "7D":
                    $entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "ext", SORT_STRING, SORT_DESC, "name", SORT_STRING, SORT_ASC);
                    $or7 = "7A";
                    break;
            }
        }
        $out .= "\r\n        <script language=\"Javascript\" type=\"text/javascript\">\r\n        <!--\r\n        function go(arg) {\r\n            document.location.href='" . addslashes($path_info["basename"]) . "?frame=3&current_dir=" . addslashes($current_dir) . "'+arg+'/';\r\n        }\r\n        function resolveIDs() {\r\n            document.location.href='" . addslashes($path_info["basename"]) . "?frame=3&set_resolveIDs=1&current_dir=" . addslashes($current_dir) . "';\r\n        }\r\n        var entry_list = new Array();\r\n        // Custom object constructor\r\n        function entry(name, type, size, selected){\r\n            this.name = name;\r\n            this.type = type;\r\n            this.size = size;\r\n            this.selected = false;\r\n        }\r\n        // Declare entry_list for selection procedures";
        foreach ($entry_list as $i => $data) {
            $out .= "\nentry_list['entry{$i}'] = new entry('" . addslashes($data["name"]) . "', '" . $data["type"] . "', " . $data["size"] . ", false);";
        }
        $out .= "\r\n        // Select/Unselect Rows OnClick/OnMouseOver\r\n        var lastRows = new Array(null,null);\r\n        function selectEntry(Row, Action){\r\n            if (multipleSelection){\r\n                // Avoid repeated onmouseover events from same Row ( cell transition )\r\n                if (Row != lastRows[0]){\r\n                    if (Action == 'over') {\r\n                        if (entry_list[Row.id].selected){\r\n                            if (unselect(entry_list[Row.id])) {\r\n                                Row.className = 'entryUnselected';\r\n                            }\r\n                            // Change the last Row when you change the movement orientation\r\n                            if (lastRows[0] != null && lastRows[1] != null){\r\n                                var LastRowID = lastRows[0].id;\r\n                                if (Row.id == lastRows[1].id){\r\n                                    if (unselect(entry_list[LastRowID])) {\r\n                                        lastRows[0].className = 'entryUnselected';\r\n                                    }\r\n                                }\r\n                            }\r\n                        } else {\r\n                            if (select(entry_list[Row.id])){\r\n                                Row.className = 'entrySelected';\r\n                            }\r\n                            // Change the last Row when you change the movement orientation\r\n                            if (lastRows[0] != null && lastRows[1] != null){\r\n                                var LastRowID = lastRows[0].id;\r\n                                if (Row.id == lastRows[1].id){\r\n                                    if (select(entry_list[LastRowID])) {\r\n                                        lastRows[0].className = 'entrySelected';\r\n                                    }\r\n                                }\r\n                            }\r\n                        }\r\n                        lastRows[1] = lastRows[0];\r\n                        lastRows[0] = Row;\r\n                    }\r\n                }\r\n            } else {\r\n                if (Action == 'click') {\r\n                    var newClassName = null;\r\n                    if (entry_list[Row.id].selected){\r\n                        if (unselect(entry_list[Row.id])) newClassName = 'entryUnselected';\r\n                    } else {\r\n                        if (select(entry_list[Row.id])) newClassName = 'entrySelected';\r\n                    }\r\n                    if (newClassName) {\r\n                        lastRows[0] = lastRows[1] = Row;\r\n                        Row.className = newClassName;\r\n                    }\r\n                }\r\n            }\r\n            return true;\r\n        }\r\n        // Disable text selection and bind multiple selection flag\r\n        var multipleSelection = false;\r\n        if (is.ie) {\r\n            document.onselectstart=new Function('return false');\r\n            document.onmousedown=switch_flag_on;\r\n            document.onmouseup=switch_flag_off;\r\n            // Event mouseup is not generated over scrollbar.. curiously, mousedown is.. go figure.\r\n            window.onscroll=new Function('multipleSelection=false');\r\n            window.onresize=new Function('multipleSelection=false');\r\n        } else {\r\n            if (document.layers) window.captureEvents(Event.MOUSEDOWN);\r\n            if (document.layers) window.captureEvents(Event.MOUSEUP);\r\n            window.onmousedown=switch_flag_on;\r\n            window.onmouseup=switch_flag_off;\r\n        }\r\n        // Using same function and a ternary operator couses bug on double click\r\n        function switch_flag_on(e) {\r\n            if (is.ie){\r\n                multipleSelection = (event.button == 1);\r\n            } else {\r\n                multipleSelection = (e.which == 1);\r\n            }\r\n\t\t\tvar type = String(e.target.type);\r\n\t\t\treturn (type.indexOf('select') != -1 || type.indexOf('button') != -1 || type.indexOf('input') != -1 || type.indexOf('radio') != -1);\r\n        }\r\n        function switch_flag_off(e) {\r\n            if (is.ie){\r\n                multipleSelection = (event.button != 1);\r\n            } else {\r\n                multipleSelection = (e.which != 1);\r\n            }\r\n            lastRows[0] = lastRows[1] = null;\r\n            update_sel_status();\r\n            return false;\r\n        }\r\n        var total_dirs_selected = 0;\r\n        var total_files_selected = 0;\r\n        function unselect(Entry){\r\n            if (!Entry.selected) return false;\r\n            Entry.selected = false;\r\n            sel_totalsize -= Entry.size;\r\n            if (Entry.type == 'dir') total_dirs_selected--;\r\n            else total_files_selected--;\r\n            return true;\r\n        }\r\n        function select(Entry){\r\n            if(Entry.selected) return false;\r\n            Entry.selected = true;\r\n            sel_totalsize += Entry.size;\r\n            if(Entry.type == 'dir') total_dirs_selected++;\r\n            else total_files_selected++;\r\n            return true;\r\n        }\r\n        function is_anything_selected(){\r\n            var selected_dir_list = new Array();\r\n            var selected_file_list = new Array();\r\n            for(var x=0;x<" . (int) count($entry_list) . ";x++){\r\n                if(entry_list['entry'+x].selected){\r\n                    if(entry_list['entry'+x].type == 'dir') selected_dir_list.push(entry_list['entry'+x].name);\r\n                    else selected_file_list.push(entry_list['entry'+x].name);\r\n                }\r\n            }\r\n            document.form_action.selected_dir_list.value = selected_dir_list.join('<|*|>');\r\n            document.form_action.selected_file_list.value = selected_file_list.join('<|*|>');\r\n            return (total_dirs_selected>0 || total_files_selected>0);\r\n        }\r\n        function format_size (arg) {\r\n            var resul = '';\r\n            if (arg>0){\r\n                var j = 0;\r\n                var ext = new Array(' bytes',' Kb',' Mb',' Gb',' Tb');\r\n                while (arg >= Math.pow(1024,j)) ++j;\r\n                resul = (Math.round(arg/Math.pow(1024,j-1)*100)/100) + ext[j-1];\r\n            } else resul = 0;\r\n            return resul;\r\n        }\r\n        var sel_totalsize = 0;\r\n        function update_sel_status(){\r\n            var t = total_dirs_selected+' " . et('Dir_s') . " " . et('And') . " '+total_files_selected+' " . et('File_s') . " " . et('Selected_s') . " = '+format_size(sel_totalsize);\r\n            //document.getElementById(\"sel_status\").innerHTML = t;\r\n            window.status = t;\r\n        }\r\n        // Select all/none/inverse\r\n        function selectANI(Butt){\r\n        \tcancel_copy_move();\r\n            for(var x=0;x<" . (int) count($entry_list) . ";x++){\r\n                var Row = document.getElementById('entry'+x);\r\n                var newClassName = null;\r\n                switch (Butt.value){\r\n                    case '" . et('SelAll') . "':\r\n                        if (select(entry_list[Row.id])) newClassName = 'entrySelected';\r\n                    break;\r\n                    case '" . et('SelNone') . "':\r\n                        if (unselect(entry_list[Row.id])) newClassName = 'entryUnselected';\r\n                    break;\r\n                    case '" . et('SelInverse') . "':\r\n                        if (entry_list[Row.id].selected){\r\n                            if (unselect(entry_list[Row.id])) newClassName = 'entryUnselected';\r\n                        } else {\r\n                            if (select(entry_list[Row.id])) newClassName = 'entrySelected';\r\n                        }\r\n                    break;\r\n                }\r\n                if (newClassName) {\r\n                    Row.className = newClassName;\r\n                }\r\n            }\r\n            if (Butt.value == '" . et('SelAll') . "'){\r\n                for(var i=0;i<2;i++){\r\n                    document.getElementById('ANI'+i).value='" . et('SelNone') . "';\r\n                }\r\n            } else if (Butt.value == '" . et('SelNone') . "'){\r\n                for(var i=0;i<2;i++){\r\n                    document.getElementById('ANI'+i).value='" . et('SelAll') . "';\r\n                }\r\n            }\r\n            update_sel_status();\r\n            return true;\r\n        }\r\n        function download(arg){\r\n            parent.frame1.location.href='" . addslashes($path_info["basename"]) . "?action=3&current_dir=" . addslashes($current_dir) . "&filename='+escape(arg);\r\n        }\r\n        function upload(){\r\n            var w = 400;\r\n            var h = 250;\r\n            window.open('" . addslashes($path_info["basename"]) . "?action=10&current_dir=" . addslashes($current_dir) . "', '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=no,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n        }\r\n        function execute_cmd(){\r\n            var arg = prompt('" . et('TypeCmd') . ".');\r\n            if(arg.length>0){\r\n                if(confirm('" . et('ConfExec') . " \\' '+arg+' \\' ?')) {\r\n                    var w = 800;\r\n                    var h = 600;\r\n                    window.open('" . addslashes($path_info["basename"]) . "?action=6&current_dir=" . addslashes($current_dir) . "&cmd='+escape(arg), '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n                }\r\n            }\r\n        }\r\n        function decompress(arg){\r\n            if(confirm('" . uppercase(et('Decompress')) . " \\' '+arg+' \\' ?')) {\r\n                document.form_action.action.value = 72;\r\n                document.form_action.cmd_arg.value = arg;\r\n                document.form_action.submit();\r\n            }\r\n        }\r\n        function execute_file(arg){\r\n            if(arg.length>0){\r\n                if(confirm('" . et('ConfExec') . " \\' '+arg+' \\' ?')) {\r\n                    var w = 800;\r\n                    var h = 600;\r\n                    window.open('" . addslashes($path_info["basename"]) . "?action=11&current_dir=" . addslashes($current_dir) . "&filename='+escape(arg), '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n                }\r\n            }\r\n        }\r\n        function edit_file(arg){\r\n            var w = 1024;\r\n            var h = 768;\r\n            // if(confirm('" . uppercase(et('Edit')) . " \\' '+arg+' \\' ?'))\r\n            window.open('" . addslashes($path_info["basename"]) . "?action=7&current_dir=" . addslashes($current_dir) . "&filename='+escape(arg), '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=no,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n        }\r\n        function config(){\r\n            var w = 650;\r\n            var h = 400;\r\n            window.open('" . addslashes($path_info["basename"]) . "?action=2', 'win_config', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n        }\r\n        function server_info(arg){\r\n            var w = 800;\r\n            var h = 600;\r\n            window.open('" . addslashes($path_info["basename"]) . "?action=5', 'win_serverinfo', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n        }\r\n        function shell(){\r\n            var w = 800;\r\n            var h = 600;\r\n            window.open('" . addslashes($path_info["basename"]) . "?action=9', '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n        }\r\n        function view(arg){\r\n            var w = 800;\r\n            var h = 600;\r\n            if(confirm('" . uppercase(et('View')) . " \\' '+arg+' \\' ?')) window.open('" . addslashes($path_info["basename"]) . "?action=4&current_dir=" . addslashes($current_dir) . "&filename='+escape(arg), '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=yes,toolbar=no,menubar=no,location=yes');\r\n        }\r\n        function rename(arg){\r\n            var nome = '';\r\n            if (nome = prompt('" . uppercase(et('Ren')) . " \\' '+arg+' \\' " . et('To') . " ...')) document.location.href='" . addslashes($path_info["basename"]) . "?frame=3&action=3&current_dir=" . addslashes($current_dir) . "&old_name='+escape(arg)+'&new_name='+escape(nome);\r\n        }\r\n        function set_dir_dest(arg){\r\n            document.form_action.dir_dest.value=arg;\r\n            if (document.form_action.action.value.length>0) test(document.form_action.action.value);\r\n            else alert('" . et('JSError') . ".');\r\n        }\r\n        function sel_dir(arg){\r\n            document.form_action.action.value = arg;\r\n            document.form_action.dir_dest.value='';\r\n            if (!is_anything_selected()) alert('" . et('NoSel') . ".');\r\n            else {\r\n                if (!getCookie('sel_dir_warn')) {\r\n                    //alert('" . et('SelDir') . ".');\r\n                    document.cookie='sel_dir_warn'+'='+escape('true')+';';\r\n                }\r\n                set_sel_dir_warn(true);\r\n                parent.frame2.set_flag(true);\r\n            }\r\n        }\r\n\t\tfunction set_sel_dir_warn(b){\r\n        \tdocument.getElementById(\"sel_dir_warn\").style.display=(b?'':'none');\r\n\t\t}\r\n\t\tfunction cancel_copy_move(){\r\n           \tset_sel_dir_warn(false);\r\n           \tparent.frame2.set_flag(false);\r\n\t\t}\r\n        function chmod_form(){\r\n            cancel_copy_move();\r\n            document.form_action.dir_dest.value='';\r\n            document.form_action.chmod_arg.value='';\r\n            if (!is_anything_selected()) alert('" . et('NoSel') . ".');\r\n            else {\r\n                var w = 280;\r\n                var h = 180;\r\n                window.open('" . addslashes($path_info["basename"]) . "?action=8', '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=no,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n            }\r\n        }\r\n        function set_chmod_arg(arg){\r\n            cancel_copy_move();\r\n            if (!is_anything_selected()) alert('" . et('NoSel') . ".');\r\n            else {\r\n            \tdocument.form_action.dir_dest.value='';\r\n            \tdocument.form_action.chmod_arg.value=arg;\r\n            \ttest(9);\r\n\t\t\t}\r\n        }\r\n        function test_action(){\r\n            if (document.form_action.action.value != 0) return true;\r\n            else return false;\r\n        }\r\n        function test_prompt(arg){\r\n        \tcancel_copy_move();\r\n\t\t\tvar erro='';\r\n            var conf='';\r\n            if (arg == 1){\r\n                document.form_action.cmd_arg.value = prompt('" . et('TypeDir') . ".');\r\n            } else if (arg == 2){\r\n                document.form_action.cmd_arg.value = prompt('" . et('TypeArq') . ".');\r\n            } else if (arg == 71){\r\n                if (!is_anything_selected()) erro = '" . et('NoSel') . ".';\r\n                else document.form_action.cmd_arg.value = prompt('" . et('TypeArqComp') . "');\r\n            }\r\n            if (erro!=''){\r\n                document.form_action.cmd_arg.focus();\r\n                alert(erro);\r\n            } else if(document.form_action.cmd_arg.value.length>0) {\r\n                document.form_action.action.value = arg;\r\n                document.form_action.submit();\r\n            }\r\n        }\r\n        function strstr(haystack,needle){\r\n            var index = haystack.indexOf(needle);\r\n            return (index==-1)?false:index;\r\n        }\r\n        function valid_dest(dest,orig){\r\n            return (strstr(dest,orig)==false)?true:false;\r\n        }\r\n        // ArrayAlert - Selection debug only\r\n        function aa(){\r\n            var str = 'selected_dir_list:\\n';\r\n            for (x=0;x<selected_dir_list.length;x++){\r\n                str += selected_dir_list[x]+'\\n';\r\n            }\r\n            str += '\\nselected_file_list:\\n';\r\n            for (x=0;x<selected_file_list.length;x++){\r\n                str += selected_file_list[x]+'\\n';\r\n            }\r\n            alert(str);\r\n        }\r\n        function test(arg){\r\n        \tcancel_copy_move();\r\n            var erro='';\r\n            var conf='';\r\n            if (arg == 4){\r\n                if (!is_anything_selected()) erro = '" . et('NoSel') . ".\\n';\r\n                conf = '" . et('RemSel') . " ?\\n';\r\n            } else if (arg == 5){\r\n                if (!is_anything_selected()) erro = '" . et('NoSel') . ".\\n';\r\n                else if(document.form_action.dir_dest.value.length == 0) erro = '" . et('NoDestDir') . ".';\r\n                else if(document.form_action.dir_dest.value == document.form_action.current_dir.value) erro = '" . et('DestEqOrig') . ".';\r\n                else if(!valid_dest(document.form_action.dir_dest.value,document.form_action.current_dir.value)) erro = '" . et('InvalidDest') . ".';\r\n                conf = '" . et('CopyTo') . " \\' '+document.form_action.dir_dest.value+' \\' ?\\n';\r\n            } else if (arg == 6){\r\n                if (!is_anything_selected()) erro = '" . et('NoSel') . ".';\r\n                else if(document.form_action.dir_dest.value.length == 0) erro = '" . et('NoDestDir') . ".';\r\n                else if(document.form_action.dir_dest.value == document.form_action.current_dir.value) erro = '" . et('DestEqOrig') . ".';\r\n                else if(!valid_dest(document.form_action.dir_dest.value,document.form_action.current_dir.value)) erro = '" . et('InvalidDest') . ".';\r\n                conf = '" . et('MoveTo') . " \\' '+document.form_action.dir_dest.value+' \\' ?\\n';\r\n            } else if (arg == 9){\r\n                if (!is_anything_selected()) erro = '" . et('NoSel') . ".';\r\n                else if(document.form_action.chmod_arg.value.length == 0) erro = '" . et('NoNewPerm') . ".';\r\n                //conf = '" . et('AlterPermTo') . " \\' '+document.form_action.chmod_arg.value+' \\' ?\\n';\r\n            }\r\n            if (erro!=''){\r\n                document.form_action.cmd_arg.focus();\r\n                alert(erro);\r\n            } else if(conf!='') {\r\n                if(confirm(conf)) {\r\n                    document.form_action.action.value = arg;\r\n                    document.form_action.submit();\r\n                } else {\r\n                    set_sel_dir_warn(false);\r\n\t\t\t\t}\r\n            } else {\r\n                document.form_action.action.value = arg;\r\n                document.form_action.submit();\r\n            }\r\n        }\r\n        //-->\r\n        </script>";
        $out .= "\r\n        <form name=\"form_action\" action=\"" . $path_info["basename"] . "\" method=\"post\" onsubmit=\"return test_action();\">\r\n            <input type=hidden name=\"frame\" value=3>\r\n            <input type=hidden name=\"action\" value=0>\r\n            <input type=hidden name=\"dir_dest\" value=\"\">\r\n            <input type=hidden name=\"chmod_arg\" value=\"\">\r\n            <input type=hidden name=\"cmd_arg\" value=\"\">\r\n            <input type=hidden name=\"current_dir\" value=\"{$current_dir}\">\r\n            <input type=hidden name=\"dir_before\" value=\"{$dir_before}\">\r\n            <input type=hidden name=\"selected_dir_list\" value=\"\">\r\n            <input type=hidden name=\"selected_file_list\" value=\"\">";
        $out .= "\r\n            <tr>\r\n            <td bgcolor=\"#DDDDDD\" colspan=50><nobr>\r\n            <input type=button onclick=\"config()\" value=\"" . et('Config') . "\">\r\n            <input type=button onclick=\"server_info()\" value=\"" . et('ServerInfo') . "\">\r\n            <input type=button onclick=\"test_prompt(1)\" value=\"" . et('CreateDir') . "\">\r\n            <input type=button onclick=\"test_prompt(2)\" value=\"" . et('CreateArq') . "\">\r\n            <input type=button onclick=\"execute_cmd()\" value=\"" . et('ExecCmd') . "\">\r\n            <input type=button onclick=\"upload()\" value=\"" . et('Upload') . "\">\r\n            <input type=button onclick=\"shell()\" value=\"" . et('Shell') . "\">\r\n            <b>{$ip}</b>\r\n            </nobr>";
        $uplink = "";
        if ($current_dir != $fm_current_root) {
            $mat = explode("/", $current_dir);
            $dir_before = "";
            for ($x = 0; $x < count($mat) - 2; $x++) {
                $dir_before .= $mat[$x] . "/";
            }
            $uplink = "<a href=\"" . $path_info["basename"] . "?frame=3&current_dir={$dir_before}\"><<</a> ";
        }
        if ($entry_count) {
            $out .= "\r\n                <tr bgcolor=\"#DDDDDD\"><td colspan=50><nobr>{$uplink} <a href=\"" . $path_info["basename"] . "?frame=3&current_dir={$current_dir}\">{$current_dir}</a></nobr>\r\n                <tr>\r\n                <td bgcolor=\"#DDDDDD\" colspan=50><nobr>\r\n                    <input type=\"button\" style=\"width:80\" onclick=\"selectANI(this)\" id=\"ANI0\" value=\"" . et('SelAll') . "\">\r\n                    <input type=\"button\" style=\"width:80\" onclick=\"selectANI(this)\" value=\"" . et('SelInverse') . "\">\r\n                    <input type=\"button\" style=\"width:80\" onclick=\"test(4)\" value=\"" . et('Rem') . "\">\r\n                    <input type=\"button\" style=\"width:80\" onclick=\"sel_dir(5)\" value=\"" . et('Copy') . "\">\r\n                    <input type=\"button\" style=\"width:80\" onclick=\"sel_dir(6)\" value=\"" . et('Move') . "\">\r\n                    <input type=\"button\" style=\"width:100\" onclick=\"test_prompt(71)\" value=\"" . et('Compress') . "\">";
            if ($islinux) {
                $out .= "\r\n                    <input type=\"button\" style=\"width:100\" onclick=\"resolveIDs()\" value=\"" . et('ResolveIDs') . "\">";
            }
            $out .= "\r\n                    <input type=\"button\" style=\"width:100\" onclick=\"chmod_form()\" value=\"" . et('Perms') . "\">";
            $out .= "\r\n                </nobr></td>\r\n                </tr>\r\n\t\t\t\t<tr>\r\n                <td bgcolor=\"#DDDDDD\" colspan=50 id=\"sel_dir_warn\" style=\"display:none\"><nobr><font color=\"red\">" . et('SelDir') . "...</font></nobr></td>\r\n                </tr>";
            $file_count = 0;
            $dir_count = 0;
            $dir_out = array();
            $file_out = array();
            $max_opt = 0;
            foreach ($entry_list as $ind => $dir_entry) {
                $file = $dir_entry["name"];
                if ($dir_entry["type"] == "dir") {
                    $dir_out[$dir_count] = array();
                    $dir_out[$dir_count][] = "\r\n                        <tr ID=\"entry{$ind}\" class=\"entryUnselected\" onmouseover=\"selectEntry(this, 'over');\" onmousedown=\"selectEntry(this, 'click');\">\r\n                        <td><nobr><a href=\"JavaScript:go('" . addslashes($file) . "')\">{$file}</a></nobr></td>";
                    $dir_out[$dir_count][] = "<td>" . $dir_entry["p"] . "</td>";
                    if ($islinux) {
                        $dir_out[$dir_count][] = "<td><nobr>" . $dir_entry["u"] . "</nobr></td>";
                        $dir_out[$dir_count][] = "<td><nobr>" . $dir_entry["g"] . "</nobr></td>";
                    }
                    $dir_out[$dir_count][] = "<td><nobr>" . $dir_entry["sizet"] . "</nobr></td>";
                    $dir_out[$dir_count][] = "<td><nobr>" . $dir_entry["datet"] . "</nobr></td>";
                    if ($has_files) {
                        $dir_out[$dir_count][] = "<td>&nbsp;</td>";
                    }
                    // Opções de diretório
                    if (is_writable($current_dir . $file)) {
                        $dir_out[$dir_count][] = "\r\n                        <td align=center><a href=\"JavaScript:if(confirm('" . et('ConfRem') . " \\'" . addslashes($file) . "\\' ?')) document.location.href='" . addslashes($path_info["basename"]) . "?frame=3&action=8&cmd_arg=" . addslashes($file) . "&current_dir=" . addslashes($current_dir) . "'\">" . et('Rem') . "</a>";
                    }
                    if (is_writable($current_dir . $file)) {
                        $dir_out[$dir_count][] = "\r\n                        <td align=center><a href=\"JavaScript:rename('" . addslashes($file) . "')\">" . et('Ren') . "</a>";
                    }
                    if (count($dir_out[$dir_count]) > $max_opt) {
                        $max_opt = count($dir_out[$dir_count]);
                    }
                    $dir_count++;
                } else {
                    $file_out[$file_count] = array();
                    $file_out[$file_count][] = "\r\n                        <tr ID=\"entry{$ind}\" class=\"entryUnselected\" onmouseover=\"selectEntry(this, 'over');\" onmousedown=\"selectEntry(this, 'click');\">\r\n                        <td><nobr><a href=\"JavaScript:download('" . addslashes($file) . "')\">{$file}</a></nobr></td>";
                    $file_out[$file_count][] = "<td>" . $dir_entry["p"] . "</td>";
                    if ($islinux) {
                        $file_out[$file_count][] = "<td><nobr>" . $dir_entry["u"] . "</nobr></td>";
                        $file_out[$file_count][] = "<td><nobr>" . $dir_entry["g"] . "</nobr></td>";
                    }
                    $file_out[$file_count][] = "<td><nobr>" . $dir_entry["sizet"] . "</nobr></td>";
                    $file_out[$file_count][] = "<td><nobr>" . $dir_entry["datet"] . "</nobr></td>";
                    $file_out[$file_count][] = "<td>" . $dir_entry["extt"] . "</td>";
                    // Opções de arquivo
                    if (is_writable($current_dir . $file)) {
                        $file_out[$file_count][] = "\r\n                                <td align=center><a href=\"javascript:if(confirm('" . uppercase(et('Rem')) . " \\'" . addslashes($file) . "\\' ?')) document.location.href='" . addslashes($path_info["basename"]) . "?frame=3&action=8&cmd_arg=" . addslashes($file) . "&current_dir=" . addslashes($current_dir) . "'\">" . et('Rem') . "</a>";
                    } else {
                        $file_out[$file_count][] = "<td>&nbsp;</td>";
                    }
                    if (is_writable($current_dir . $file)) {
                        $file_out[$file_count][] = "\r\n                                <td align=center><a href=\"javascript:rename('" . addslashes($file) . "')\">" . et('Ren') . "</a>";
                    } else {
                        $file_out[$file_count][] = "<td>&nbsp;</td>";
                    }
                    if (is_readable($current_dir . $file) && strpos(".wav#.mp3#.mid#.avi#.mov#.mpeg#.mpg#.rm#.iso#.bin#.img#.dll#.psd#.fla#.swf#.class#.ppt#.tif#.tiff#.pcx#.jpg#.gif#.png#.wmf#.eps#.bmp#.msi#.exe#.com#.rar#.tar#.zip#.bz2#.tbz2#.bz#.tbz#.bzip#.gzip#.gz#.tgz#", $dir_entry["ext"] . "#") === false) {
                        $file_out[$file_count][] = "\r\n                                <td align=center><a href=\"javascript:edit_file('" . addslashes($file) . "')\">" . et('Edit') . "</a>";
                    } else {
                        $file_out[$file_count][] = "<td>&nbsp;</td>";
                    }
                    if (is_readable($current_dir . $file) && strpos(".txt#.sys#.bat#.ini#.conf#.swf#.php#.php3#.asp#.html#.htm#.jpg#.gif#.png#.bmp#", $dir_entry["ext"] . "#") !== false) {
                        $file_out[$file_count][] = "\r\n                                <td align=center><a href=\"javascript:view('" . addslashes($file) . "');\">" . et('View') . "</a>";
                    } else {
                        $file_out[$file_count][] = "<td>&nbsp;</td>";
                    }
                    if (is_readable($current_dir . $file) && strlen($dir_entry["ext"]) && strpos(".tar#.zip#.bz2#.tbz2#.bz#.tbz#.bzip#.gzip#.gz#.tgz#", $dir_entry["ext"] . "#") !== false) {
                        $file_out[$file_count][] = "\r\n                                <td align=center><a href=\"javascript:decompress('" . addslashes($file) . "')\">" . et('Decompress') . "</a>";
                    } else {
                        $file_out[$file_count][] = "<td>&nbsp;</td>";
                    }
                    if (is_readable($current_dir . $file) && strlen($dir_entry["ext"]) && strpos(".exe#.com#.sh#.bat#", $dir_entry["ext"] . "#") !== false) {
                        $file_out[$file_count][] = "\r\n                                <td align=center><a href=\"javascript:execute_file('" . addslashes($file) . "')\">" . et('Exec') . "</a>";
                    } else {
                        $file_out[$file_count][] = "<td>&nbsp;</td>";
                    }
                    if (count($file_out[$file_count]) > $max_opt) {
                        $max_opt = count($file_out[$file_count]);
                    }
                    $file_count++;
                }
            }
            if ($dir_count) {
                $out .= "\r\n                <tr>\r\n                      <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or1}&current_dir={$current_dir}\">" . et('Name') . "</a></nobr></td>\r\n                      <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or2}&current_dir={$current_dir}\">" . et('Perm') . "</a></nobr></td>";
                if ($islinux) {
                    $out .= "\r\n                      <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or3}&current_dir={$current_dir}\">" . et('Owner') . "</a></td>\r\n                      <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or4}&current_dir={$current_dir}\">" . et('Group') . "</a></nobr></td>";
                }
                $out .= "\r\n                      <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or5}&current_dir={$current_dir}\">" . et('Size') . "</a></nobr></td>\r\n                      <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or6}&current_dir={$current_dir}\">" . et('Date') . "</a></nobr></td>";
                if ($file_count) {
                    $out .= "\r\n                      <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or7}&current_dir={$current_dir}\">" . et('Type') . "</a></nobr></td>";
                }
                $out .= "\r\n                      <td bgcolor=\"#DDDDDD\" colspan=50>&nbsp;</td>\r\n                </tr>";
            }
            foreach ($dir_out as $k => $v) {
                while (count($dir_out[$k]) < $max_opt) {
                    $dir_out[$k][] = "<td>&nbsp;</td>";
                }
                $out .= implode($dir_out[$k]);
                $out .= "</tr>";
            }
            if ($file_count) {
                $out .= "\r\n                <tr>\r\n                      <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or1}&current_dir={$current_dir}\">" . et('Name') . "</a></nobr></td>\r\n                      <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or2}&current_dir={$current_dir}\">" . et('Perm') . "</a></nobr></td>";
                if ($islinux) {
                    $out .= "\r\n                      <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or3}&current_dir={$current_dir}\">" . et('Owner') . "</a></td>\r\n                      <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or4}&current_dir={$current_dir}\">" . et('Group') . "</a></nobr></td>";
                }
                $out .= "\r\n                      <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or5}&current_dir={$current_dir}\">" . et('Size') . "</a></nobr></td>\r\n                      <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or6}&current_dir={$current_dir}\">" . et('Date') . "</a></nobr></td>\r\n                      <td bgcolor=\"#DDDDDD\"><nobr><a href=\"" . $path_info["basename"] . "?frame=3&or_by={$or7}&current_dir={$current_dir}\">" . et('Type') . "</a></nobr></td>\r\n                      <td bgcolor=\"#DDDDDD\" colspan=50>&nbsp;</td>\r\n                </tr>";
            }
            foreach ($file_out as $k => $v) {
                while (count($file_out[$k]) < $max_opt) {
                    $file_out[$k][] = "<td>&nbsp;</td>";
                }
                $out .= implode($file_out[$k]);
                $out .= "</tr>";
            }
            $out .= "\r\n                <tr>\r\n                <td bgcolor=\"#DDDDDD\" colspan=50><nobr>\r\n                      <input type=\"button\" style=\"width:80\" onclick=\"selectANI(this)\" id=\"ANI1\" value=\"" . et('SelAll') . "\">\r\n                      <input type=\"button\" style=\"width:80\" onclick=\"selectANI(this)\" value=\"" . et('SelInverse') . "\">\r\n                      <input type=\"button\" style=\"width:80\" onclick=\"test(4)\" value=\"" . et('Rem') . "\">\r\n                      <input type=\"button\" style=\"width:80\" onclick=\"sel_dir(5)\" value=\"" . et('Copy') . "\">\r\n                      <input type=\"button\" style=\"width:80\" onclick=\"sel_dir(6)\" value=\"" . et('Move') . "\">\r\n                      <input type=\"button\" style=\"width:100\" onclick=\"test_prompt(71)\" value=\"" . et('Compress') . "\">";
            if ($islinux) {
                $out .= "\r\n                      <input type=\"button\" style=\"width:100\" onclick=\"resolveIDs()\" value=\"" . et('ResolveIDs') . "\">";
            }
            $out .= "\r\n                      <input type=\"button\" style=\"width:100\" onclick=\"chmod_form()\" value=\"" . et('Perms') . "\">";
            $out .= "\r\n                </nobr></td>\r\n                </tr>";
            $out .= "\r\n            </form>";
            $out .= "\r\n                <tr><td bgcolor=\"#DDDDDD\" colspan=50><b>{$dir_count} " . et('Dir_s') . " " . et('And') . " {$file_count} " . et('File_s') . " = " . format_size($total_size) . "</td></tr>";
            if ($quota_mb) {
                $out .= "\r\n                <tr><td bgcolor=\"#DDDDDD\" colspan=50><b>" . et('Partition') . ": " . format_size($quota_mb * 1024 * 1024) . " " . et('Total') . " - " . format_size($quota_mb * 1024 * 1024 - total_size($fm_current_root)) . " " . et('Free') . "</td></tr>";
            } else {
                $out .= "\r\n                <tr><td bgcolor=\"#DDDDDD\" colspan=50><b>" . et('Partition') . ": " . format_size(disk_total_space($current_dir)) . " " . et('Total') . " - " . format_size(disk_free_space($current_dir)) . " " . et('Free') . "</td></tr>";
            }
            $tf = getmicrotime();
            $tt = $tf - $ti;
            $out .= "\r\n                <tr><td bgcolor=\"#DDDDDD\" colspan=50><b>" . et('RenderTime') . ": " . substr($tt, 0, strrpos($tt, ".") + 5) . " " . et('Seconds') . "</td></tr>";
            $out .= "\r\n            <script language=\"Javascript\" type=\"text/javascript\">\r\n            <!--\r\n                update_sel_status();\r\n            //-->\r\n            </script>";
        } else {
            $out .= "\r\n            <tr>\r\n            <td bgcolor=\"#DDDDDD\" width=\"1%\">{$uplink}<td bgcolor=\"#DDDDDD\" colspan=50><nobr><a href=\"" . $path_info["basename"] . "?frame=3&current_dir={$current_dir}\">{$current_dir}</a></nobr>\r\n            <tr><td bgcolor=\"#DDDDDD\" colspan=50>" . et('EmptyDir') . ".</tr>";
        }
    } else {
        $out .= "<tr><td><font color=red>" . et('IOError') . ".<br>{$current_dir}</font>";
    }
    $out .= "</table>";
    echo $out;
}
コード例 #30
0
ファイル: modifyalb.php プロジェクト: phill104/branches
function alb_list_box()
{
    global $CONFIG, $CLEAN, $cpg_udb, $CPG_PHP_SELF, $lang_modifyalb_php;
    //, $PHP_SELF;
    $rowset = array();
    if (GALLERY_ADMIN_MODE) {
        //$result = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category < '" . FIRST_USER_CAT . "' ORDER BY title");
        //$rowset = cpg_db_fetch_rowset($result);
        //mysql_free_result($result);
        $result = cpg_db_query("SELECT DISTINCT a.aid as aid, a.title as title, c.name as cname FROM {$CONFIG['TABLE_ALBUMS']} as a, {$CONFIG['TABLE_CATEGORIES']} as c WHERE a.category = c.cid AND a.category < '" . FIRST_USER_CAT . "'");
        while ($row = mysql_fetch_array($result)) {
            // Add to multi-dim array for later sorting
            $rowset[] = array('cat' => $row['cname'], 'aid' => $row['aid'], 'title' => $row['title']);
        }
        mysql_free_result($result);
        //now we need to select the albupms without a category
        $result = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = 0 ORDER BY title");
        while ($row = mysql_fetch_array($result)) {
            // Add to multi-dim array for later sorting
            $rowset[] = array('cat' => $lang_modifyalb_php['no_cat'], 'aid' => $row['aid'], 'title' => $row['title']);
        }
        mysql_free_result($result);
        //if (defined('UDB_INTEGRATION')) {
        $sql = $cpg_udb->get_admin_album_list();
        /*} else {
              $sql = "SELECT aid, CONCAT('(', user_name, ') ', title) AS title " . "FROM {$CONFIG['TABLE_ALBUMS']} AS a " . "INNER JOIN {$CONFIG['TABLE_USERS']} AS u ON category = (" . FIRST_USER_CAT . " + user_id) " . "ORDER BY title";
          }*/
        $result = cpg_db_query($sql);
        while ($row = mysql_fetch_array($result)) {
            //$rowset[] = $row;
            // Add to multi-dim array for later sorting
            $rowset[] = array('cat' => $lang_modifyalb_php['user_gal'], 'aid' => $row['aid'], 'title' => $row['title']);
        }
        mysql_free_result($result);
    } else {
        //Only list the albums owned by the user
        $cat = USER_ID + FIRST_USER_CAT;
        $user_id = USER_ID;
        //get albums in "my albums"
        $result = cpg_db_query("SELECT aid , title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = {$cat}");
        //$rowset_my_albums = cpg_db_fetch_rowset($result_my_albums);
        while ($row = mysql_fetch_array($result)) {
            // Add to multi-dim array for later sorting
            $rowset[] = array('cat' => $lang_modifyalb_php['my_gal'], 'aid' => $row['aid'], 'title' => $row['title']);
        }
        mysql_free_result($result);
        //get public albums
        $result = cpg_db_query("SELECT a.aid, a.title, c.name AS cname FROM {$CONFIG['TABLE_ALBUMS']} AS a INNER JOIN {$CONFIG['TABLE_CATEGORIES']} AS c ON a.owner = '{$user_id}' AND a.category = c.cid ORDER BY a.category");
        //$rowset_public_albums = cpg_db_fetch_rowset($result_public_albums);
        while ($row = mysql_fetch_array($result)) {
            // Add to multi-dim array for later sorting
            $rowset[] = array('cat' => $row['cname'], 'aid' => $row['aid'], 'title' => $row['title']);
        }
        mysql_free_result($result);
    }
    // Sort by category and album title
    $rowset = array_csort($rowset, 'cat', 'title');
    if (count($rowset)) {
        // Create the nicely sorted and formatted drop down list
        $alb_cat = '';
        $select = "<select name=\"album_listbox\" class=\"listbox\" onChange=\"if(this.options[this.selectedIndex].value) window.location.href='{$CPG_PHP_SELF}?album='+this.options[this.selectedIndex].value;\">\n";
        foreach ($rowset as $val) {
            if ($val['cat'] != $alb_cat) {
                if ($alb_cat) {
                    $select .= "</optgroup>\n";
                }
                $select .= '<optgroup label="' . $val['cat'] . '">' . "\n";
                $alb_cat = $val['cat'];
            }
            $select .= '<option value="' . $val['aid'] . '"' . ($val['aid'] == $CLEAN['album'] ? ' selected="selected"' : '') . '>   ' . $val['title'] . "</option>\n";
        }
        if ($alb_cat) {
            $select .= "</optgroup>\n";
        }
        $select .= "</select>\n";
        return $select;
    }
    /*
        if (count($rowset)) {
            $lb = "<select name=\"album_listbox\" class=\"listbox\" onChange=\"if(this.options[this.selectedIndex].value) window.location.href='{$CPG_PHP_SELF}?album='+this.options[this.selectedIndex].value;\">\n";
            foreach ($rowset as $row) {
                $selected = ($row['aid'] == $CLEAN['album']) ? 'selected="selected"' : "";
                $lb .= "        <option value=\"" . $row['aid'] . "\" $selected>" . $row['title'] . "</option>\n";
            }
            $lb .= "</select>\n";
            return $lb;
        }*/
}