Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

ranks.php

Go to the documentation of this file.
00001 
00002 /** @file ranks.php
00003 * Definition of class ranks.
00004 */
00005 #include "xml_event_parser_user.php"
00006 /**
00007 * Users ranks.
00008 * This class represents users ranks database.
00009 */
00010 class ranks : public  xml_event_parser_user
00011 {
00012 public:
00013   var ranks = array();
00014   var current_rank_name = '';
00015   /**
00016   * List defined ranks.
00017   * @return array with ranks names
00018   */
00019   function get_rank_names()
00020   {
00021     names = array();
00022     foreach( this->ranks as rank_name => rank )
00023     {
00024       names[] = rank_name;
00025     }
00026     return names;
00027   }
00028   /** Return specific rank.
00029   * @param string rank_name - rank to return
00030   * @return list of users names in rank
00031   */
00032   function get_rank( rank_name )
00033   {
00034     if( isset( this->ranks[ rank_name ] ) )
00035       return this->ranks[ rank_name ];
00036     else
00037       return array();
00038   }
00039   /** Check if action is allowed for rank.
00040   * @param string rank_name - name of rank to check
00041   * @param string action - action ad to check
00042   * @return 1 if action is allowed
00043   */
00044   function is_action_allowed( rank_name, action )
00045   {
00046     rnk = this->get_rank( rank_name );
00047     return ( rank_name == 'avatar' ) ? 
00048       1 :
00049       isset( rnk[ action ] );
00050   }
00051 
00052   function xep_open_ranks_rank( attributes )
00053   {
00054     this->current_rank_name = attributes[ 'a' ];
00055     this->ranks[ this->current_rank_name ] = array();
00056   }
00057 
00058   function xep_close_ranks_rank()
00059   {
00060     this->current_rank_name = '';
00061   }
00062 
00063   function xep_open_ranks_rank_can( attributes )
00064   {
00065     this->ranks[ this->current_rank_name ][ attributes[ 'do' ] ] = 'can';
00066   }
00067 }
00068 X-Powered-By: PHP/4.0.8-dev
00069 Content-type: text/html
00070 
00071 

Generated on Tue Mar 11 08:35:13 2003 for SES by doxygen1.2.16