# Class: CallHistoryController

# CallHistoryController

The CallHistory menu controller.

# Public Class Methods

### new ()

Show source...

        # File bbs/lib/controllers/callhistory.rb, line 57
    57:   def initialize
    58:     $session.current_area = "Call History"
    59:     $session.save
    60:   end

# Public Instance Methods

### menu ()

Show source...

        # File bbs/lib/controllers/callhistory.rb, line 62
    62:   def menu
    63:     done = false
    64:     validkeys=['A', 'D', 'F', 'M', 'T', 'X']
    65:     until done == true
    66:       key = Tgio::Input.menuprompt('menu_callhistory.ftl',validkeys, nil) # nil is for tpl vars hash
    67:       test_session
    68:       print "\n"
    69:       case key
    70:         when "A" # View All
    71:           callers = Tgtemplate::Template.parse_dataset($db[:callhistory].all)
    72:           Tgtemplate.display('callhistory.ftl', {'title'=> 'All Logged Calls','callers'=>callers})
    73:         when "D" # Show by date
    74:           searchdate = Tgio::Dates::inputdate
    75:           #callers    = Tgtemplate::Template.parse_dataset($db[:callhistory].filter(:time_login => (DateTime.parse(searchdate.asctime))..(DateTime.parse(searchdate.asctime) +1)).all)
    76:           callers    = Tgtemplate::Template.parse_dataset($db[:callhistory].filter(:time_login => (DateTime.parse(searchdate.asctime))..(DateTime.parse(searchdate.asctime) +1)).all)
    77:           Tgtemplate.display('callhistory.ftl', {'title' => "#{searchdate} History",'callers'=>callers})
    78:         when "M" # Show history for current user
    79:           callers = Tgtemplate::Template.parse_dataset($db[:callhistory].filter(:user_id => $session.user_id).all)
    80:           Tgtemplate.display('callhistory.ftl', {'title' => "#{$callerid.alias}'s History",'callers'=>callers})
    81:         when "F" # Search history by some username
    82:           #Telegard.unimplemented
    83:           searchuser = Tgio::Input::inputform(16).upcase
    84:           callers = Tgtemplate::Template.parse_dataset($db[:callhistory].filter(:alias => searchuser).all)
    85:           Tgtemplate.display('callhistory.ftl', {'title'=> "Calls for #{searchuser}",'callers'=>callers})
    86:         when "T" # Show Today's callers
    87:           searchdate = Date.today
    88:           callers    = Tgtemplate::Template.parse_dataset($db[:callhistory].filter(:time_login => (DateTime.parse(searchdate.asctime))..(DateTime.parse(searchdate.asctime) +1)).all)
    89:           Tgtemplate.display('callhistory.ftl', {'title' => "Callers Today", 'callers'=>callers})
    90:         when "X" # "Return to Main"
    91:           return 0
    92:       end #/case
    93:       test_session
    94:     end #/until
    95:   end