Ignore:
Timestamp:
Dec 18, 2005 12:16:03 AM (18 years ago)
Author:
scdev
Message:

detabbed all files ;P

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/module_maker/skel/admin.php

    r41 r42  
    2626 * CONFIG
    2727 *****************************************************************************/
    28  
     28
    2929// Titles and navigation header.
    3030$nav->addPage(_("%TITLE%"), $_SERVER['PHP_SELF']);
    31    
     31
    3232// The object to validate form input.
    3333$fv = new FormValidator();
     
    215215    // Get the information for the form.
    216216    $qid = DB::query("
    217         SELECT * 
     217        SELECT *
    218218        FROM %DB_TBL%
    219219        WHERE %PRIMARY_KEY% = '" . addslashes($id) . "'
     
    227227    // Lock this record.
    228228    $lock->set('%DB_TBL%', '%PRIMARY_KEY%', $id, $frm['<##>']);
    229    
     229
    230230    // Set misc values for the form.
    231231    $frm = array_merge(array(
     
    246246{
    247247    global $lock;
    248    
     248
    249249    $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $id);
    250250    if ($lock->isLocked() && !$lock->isMine()) {
     
    254254    // Break the cache because we are changing the list data.
    255255    SessionCache::breakCache($_SERVER['PHP_SELF']);
    256    
     256
    257257    // Get the information for this object.
    258258    $qid = DB::query("
    259         SELECT <##> 
     259        SELECT <##>
    260260        FROM %DB_TBL%
    261261        WHERE %PRIMARY_KEY% = '" . addslashes($id) . "'
     
    266266        App::dieBoomerangURL();
    267267    }
    268    
     268
    269269    // Delete the record.
    270270    DB::query("DELETE FROM %DB_TBL% WHERE %PRIMARY_KEY% = '" . addslashes($id) . "'");
    271    
     271
    272272    App::raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been deleted."), $name), MSG_SUCCESS, __FILE__, __LINE__);
    273273
     
    279279{
    280280    global $auth;
    281    
     281
    282282    // Break the cache because we are changing the list data.
    283283    SessionCache::breakCache($_SERVER['PHP_SELF']);
    284    
     284
    285285%INSERT%
    286286    $last_insert_id = mysql_insert_id(DB::getDBH());
     
    289289    $version = RecordVersion::getInstance($GLOBALS['auth']);
    290290    $version->create('%DB_TBL%', '%PRIMARY_KEY%', $last_insert_id, $frm['<##>']);
    291    
     291
    292292    App::raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been added."), $frm['<##>']), MSG_SUCCESS, __FILE__, __LINE__);
    293    
     293
    294294    return $last_insert_id;
    295295}
     
    298298{
    299299    global $auth, $lock;
    300    
     300
    301301    $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $frm['%PRIMARY_KEY%']);
    302302    if ($lock->isLocked() && !$lock->isMine()) {
     
    308308
    309309%UPDATE%
    310    
     310
    311311    // Create version.
    312312    $version = RecordVersion::getInstance($GLOBALS['auth']);
     
    323323    global $page;
    324324    global $so;
    325    
     325
    326326    $where_clause = '';
    327    
     327
    328328    // Build search query if available.
    329329    if (getFormData('search_query', false)) {
     
    333333        }
    334334    }
    335    
     335
    336336    if (getFormData('filter_<##>', false)) {
    337337        // Limit by filter.
    338338        $where_clause .= (empty($where_clause) ? 'WHERE' : 'AND') . " <##> = '" . addslashes(getFormData('filter_<##>')) . "'";
    339339    }
    340    
     340
    341341    // Count the total number of records so we can do something about the page numbers.
    342342    $qid = DB::query("
    343         SELECT COUNT(*) 
    344         FROM %DB_TBL% 
     343        SELECT COUNT(*)
     344        FROM %DB_TBL%
    345345        $where_clause
    346346    ");
    347347    list($num_results) = mysql_fetch_row($qid);
    348    
     348
    349349    // Set page numbers now we know (needed for next step).
    350350    $page->setTotalItems($num_results);
    351351    $page->calculate();
    352    
     352
    353353    // Final SQL, with sort and page limiters.
    354354    $sql = "
    355         SELECT 
    356             %DB_TBL%.*, 
     355        SELECT
     356            %DB_TBL%.*,
    357357            a1.username AS added_admin_username,
    358358            a2.username AS modified_admin_username
     
    364364        " . $page->getLimitSQL() . "
    365365    ";
    366    
     366
    367367    // A unique key for this query, with the total_items in case db records
    368368    // were added since the last cache. This identifies a unique set of
     
    375375        Prefs::setValue('cache_hash', $cache_hash, $_SERVER['PHP_SELF']);
    376376    }
    377    
     377
    378378    if (SessionCache::isCached($_SERVER['PHP_SELF'])) {
    379379        // Get the cached results.
     
    386386            $list[] = $row;
    387387        }
    388            
     388
    389389        if (isset($list) && !empty($list)) {
    390390            // Cache the results.
     
    397397
    398398function updateRank($ranks)
    399 {   
     399{
    400400    if (!is_array($ranks)) {
    401401        App::logMsg('Saving rank failed, data posted is not an array: ' . $ranks, LOG_ERR, __FILE__, __LINE__);
     
    405405    // Break the cache because we are changing the list data.
    406406    SessionCache::breakCache($_SERVER['PHP_SELF']);
    407    
     407
    408408    // Count the ranks with invalid numbers
    409409    $unspecified_counter = 0;
    410    
     410
    411411    // Go through the array of new ranks.
    412412    foreach ($ranks as $id => $new_rank) {
     
    414414            // Unspecified entries receive a sort order of 10000.
    415415            $new_rank = 10000;
    416             $unspecified_counter++; 
     416            $unspecified_counter++;
    417417        }
    418418        DB::query("
     
    422422        ");
    423423    }
    424    
     424
    425425    App::raiseMsg(_("Records have been reordered with the new rank."), MSG_SUCCESS, __FILE__, __LINE__);
    426426    if ($unspecified_counter > 0) {
Note: See TracChangeset for help on using the changeset viewer.