Changeset 1415

Show
Ignore:
Timestamp:
12/07/07 17:21:01 (8 months ago)
Author:
rho
Message:

finally elggadmin manager!!

  • added elggadmin module replacement
  • improved pages_html_form()
  • added pages_is_submitted()
  • fixed get_url_query()
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • releases/0.9/mod/admin/lib.php

    r1397 r1415  
    146146    $url = get_url($object_id, $object_type); 
    147147 
    148     if (strpos($url, '?') === 'false') { 
     148    if (strpos($url, '?') === false) { 
    149149        $sep = '?'; 
    150150    } else { 
  • releases/0.9/mod/pages/lib.php

    r1414 r1415  
    472472 
    473473function pages_html_input($type, $attrs=null) { 
    474      
     474    if (!isset($attrs)) $attrs = array(); 
     475 
    475476    $attrs = array_merge(array('type' => $type), $attrs); 
    476477 
     
    478479} 
    479480 
    480 function pages_html_form($name, $body, $method='post', $action='', $attrs=null) { 
    481     $body .= pages_html_input('hidden', array('name'=>'form_key', 'value'=>elggform_get_key())); 
    482     $attrs = array_merge(array('id'=>$name, 'name'=>$name, 'method'=>$method, 'action'=>$action,), $attrs); 
     481function pages_html_form($name, $body, $attrs=null) { 
     482    if (!isset($attrs)) {$attrs = array();} 
     483 
     484    if (!isset($attrs['id'])) { $attrs['id'] = $name; } 
     485    if (!isset($attrs['name'])) { $attrs['name'] = $name; } 
     486    if (!isset($attrs['method'])) { $attrs['method'] = 'post'; } 
     487    if (!isset($attrs['action'])) { $attrs['action'] = ''; } 
     488 
     489    if (isset($attrs['buttons'])) { 
     490        $buttons = $attrs['buttons']; 
     491    } else { 
     492        $buttons = pages_html_input('submit', array('value' => __gettext('Submit'))); 
     493    } 
     494 
     495    // add form key 
     496    $buttons .= pages_html_input('hidden', array('name'=>'form_key', 'value'=>elggform_key_get($name))); 
     497 
     498    $body .= pages_html_wrap('div', $buttons, array('class' => 'form-buttons')); 
     499 
    483500    return pages_html_wrap('form', $body, $attrs); 
    484501} 
    485502 
    486503function pages_html_select($name, $options, $attrs=null) { 
     504    if (!isset($attrs)) $attrs = array(); 
     505 
    487506    $opts = ''; 
    488507    foreach ($options as $opt) { 
     
    508527    foreach ($props as $prop => $val) { 
    509528        $result .= " {$prop}=" . $db->qstr($val, true); 
     529    } 
     530 
     531    return $result; 
     532} 
     533 
     534function pages_is_submitted() { 
     535    $result = false; 
     536 
     537    if (isset($_POST['submit']) || strtolower($_SERVER['REQUEST_METHOD']) == 'post') { 
     538        $result = true; 
    510539    } 
    511540