当前位置: 首页>>代码示例>>PHP>>正文


PHP array_csort函数代码示例

本文整理汇总了PHP中array_csort函数的典型用法代码示例。如果您正苦于以下问题:PHP array_csort函数的具体用法?PHP array_csort怎么用?PHP array_csort使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了array_csort函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: albumselect

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";
}
开发者ID:phill104,项目名称:branches,代码行数:80,代码来源:picmgr.php

示例2: getOpponents


//.........这里部分代码省略.........
         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;
 }
开发者ID:Heart1010,项目名称:JoomLeague,代码行数:101,代码来源:rivals.php

示例3: array_csort

												</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();
开发者ID:eureka2,项目名称:web2project,代码行数:31,代码来源:tasks.php

示例4: albumselect

/**
 * 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";
}
开发者ID:phill104,项目名称:branches,代码行数:75,代码来源:mod_lang.php

示例5: process_page


//.........这里部分代码省略.........
         }
         $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();
 }
开发者ID:rgauss,项目名称:sugarcrm_dev,代码行数:101,代码来源:Popup_picker.php

示例6: get_select_options_with_id

$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':
开发者ID:klr2003,项目名称:sourceread,代码行数:31,代码来源:OpenListView.php

示例7: get_form_header

    $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;
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:31,代码来源:SubPanelView.php

示例8: getHistory


//.........这里部分代码省略.........
         } 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;
 }
开发者ID:apikck,项目名称:HistoricalSummary,代码行数:101,代码来源:CustomHistorySummaryAPI.php

示例9: util_filloptions

 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 {
//.........这里部分代码省略.........
开发者ID:phill104,项目名称:branches,代码行数:101,代码来源:udb_base.inc.php

示例10: getBlinePassmk

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"';
开发者ID:vinod-co,项目名称:centa,代码行数:31,代码来源:class_totals_xml.php

示例11: array_csort

// ---------------------------------------------------
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);
开发者ID:noikiy,项目名称:owaspbwa,代码行数:31,代码来源:tiki-admin_categories.php

示例12: form_alb_list_box

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>
//.........这里部分代码省略.........
开发者ID:phill104,项目名称:branches,代码行数:101,代码来源:upload.php

示例13: upload_form_alb_list

/**
 * 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";
                    }
//.........这里部分代码省略.........
开发者ID:phill104,项目名称:branches,代码行数:101,代码来源:functions.inc.php

示例14: process_page

 /**
  *
  */
 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':
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:101,代码来源:Popup_picker.php

示例15: draw_toprightmenu

<?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>  
开发者ID:vinod-co,项目名称:centa,代码行数:31,代码来源:recycle_list.php


注:本文中的array_csort函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。