<?php
/**
 * appRain CMF
 *
 * LICENSE
 *
 * This source file is subject to the MIT license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.opensource.org/licenses/mit-license.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@apprain.com so we can send you a copy immediately.
 *
 * @copyright  Copyright (c) 2010 appRain, Team. (http://www.apprain.com)
 * @license    http://www.opensource.org/licenses/mit-license.php MIT license
 *
 * HELP
 *
 * Official Website
 * http://www.apprain.com/
 *
 * Download Link
 * http://www.apprain.com/download
 *
 * Documents Link
 * http ://www.apprain.com/docs
 */
 
if( $action == 'view'):

    App::Helper('Toolbar')->setTitle("Account Information")->setBtnBack()->Render(array('code'=>'member_account_view_top','id'=>$member_info['id']));
    
    if( $message != ''){ echo $this->callElement('default/tools/message', array('caption' =>'Message','type' => 'success', 'message' => $message));}

    $Grid = App::Module('DataGrid')->setDisplay('FormListing')
                ->addRow("First Name", $member_info['f_name'])
                ->addRow("Last Name", $member_info['l_name'])
                ->addRow("Email",$member_info['email'])
                ->addRow("Phone No",$member_info['phone_no'])
                ->addRow("Address",$member_info['address'])
                ->addRow("State",$member_info['state'])
                ->addRow("Zipcode",$member_info['zipcode'])
                ->addRow("Country",$member_info['country'])
                ->addRow("Date Signup",App::Load("Helper/Date")->dateFormated($member_info['signup_date']))
                ->Render();
                
    App::Helper('Toolbar')->setFormJustified(true)->setBtnBack()->Render(array('code'=>'member_account_view_bottom','id'=>$member_info['id']));    

elseif ($action=='edit'):

    echo $this->get_tag("form", array('id'=>'member_update_form',"method"=>"post","action"=>$this->baseurl("/member/account")));
    echo App::Load("Helper/Html")->hiddenTag("data[Member][id]",$member_info['id']);    
    App::Helper('Toolbar')->setTitle("Account Information")->setBtnSave()->setBtnBack()->Render(array('code'=>'member_account_update_top','id'=>$member_info['id']));    
    $Grid = App::Module('DataGrid')->setDisplay('FormListing')
                ->addRow("First Name",App::Load("Helper/Html")->inputTag("data[Member][f_name]",$member_info['f_name'],array("id"=>"f_name","class"=>"app_input check_notempty")))
                ->addRow("Last Name",App::Load("Helper/Html")->inputTag("data[Member][l_name]",$member_info['l_name'],array("id"=>"l_name","class"=>"app_input check_notempty")))
                ->addRow("Phone No",App::Load("Helper/Html")->inputTag("data[Member][phone_no]",$member_info['phone_no'],array("class"=>"app_input")))
                ->addRow("Address",App::Load("Helper/Html")->textareaTag("data[Member][address]",$member_info['address'],array("class"=>"app_input","rows"=>"5")))
                ->addRow("State",App::Load("Helper/Html")->inputTag("data[Member][state]",$member_info['state'],array("class"=>"app_input")))
                ->addRow("Zipcode", App::Load("Helper/Html")->inputTag("data[Member][zipcode]",$member_info['zipcode'],array("class"=>"app_input")))
                ->addRow("Country",App::Load("Helper/Html")->countryTag("data[Member][country]",$member_info['country'],array('id' => 'country')))
                ->Render();
    App::Helper('Toolbar')->setBtnSave()->setBtnBack()->setFormJustified(true)->Render(array('code'=>'member_account_update_bottom','id'=>$member_info['id']));   
    App::Helper('JavaScript')->appForm('#member_update_form');
    echo $this->get_tag("/form");

endif;