Back to index

gcompris  8.2.2
Functions | Variables
admin.constants Namespace Reference

Functions

def get_next_class_id
def get_next_group_id
def get_next_profile_id
def get_wholegroup_id
def get_class_name_for_group_id

Variables

int COLUMN_WIDTH_LOGIN = 80
int COLUMN_WIDTH_FIRSTNAME = 100
int COLUMN_WIDTH_LASTNAME = 180
int COLUMN_WIDTH_BIRTHDATE = 40
int COLUMN_WIDTH_CLASSNAME = 100
int COLUMN_WIDTH_TEACHER = 300
int COLUMN_WIDTH_GROUPNAME = 100
int COLUMN_WIDTH_GROUPDESCRIPTION = 200
int COLUMN_WIDTH_GROUPDESCRIPTION_EDIT = 150
int COLUMN_WIDTH_PROFILENAME = 100
int COLUMN_WIDTH_PROFILEDESCRIPTION = 300

Function Documentation

def admin.constants.get_class_name_for_group_id (   con,
  cur,
  group_id 
)

Definition at line 97 of file constants.py.

00097 
00098 def get_class_name_for_group_id(con, cur, group_id):
00099 
00100     class_name = ""
00101     
00102     # Extract the class name of this group
00103     cur.execute('SELECT class_id FROM groups WHERE group_id=?',
00104                      (group_id,))
00105     result = cur.fetchall()
00106     if(result):
00107         class_id = result[0][0]
00108 
00109         cur.execute('SELECT name FROM class WHERE class_id=?',
00110                     (class_id,))
00111         result = cur.fetchall()
00112         if(result):
00113             class_name = result[0][0]
00114 
00115     return class_name
def admin.constants.get_next_class_id (   con,
  cur 
)

Definition at line 44 of file constants.py.

00044 
00045 def get_next_class_id(con, cur):
00046     cur.execute('select max(class_id) from class')
00047     class_id = cur.fetchone()[0]
00048     
00049     if(class_id == None):
00050         class_id=0
00051     else:
00052         class_id += 1
00053       
00054     return class_id
00055 
00056 
00057 
00058 # Return the next group id in the base
# Params are db_connect, db_cursor
def admin.constants.get_next_group_id (   con,
  cur 
)

Definition at line 59 of file constants.py.

00059 
00060 def get_next_group_id(con, cur):
00061     cur.execute('select max(group_id) from groups')
00062     group_id = cur.fetchone()[0]
00063     
00064     if(group_id == None):
00065         group_id=0
00066     else:
00067         group_id += 1
00068       
00069     return group_id
00070 
00071 
00072 # Return the next profile id in the base
# Params are db_connect, db_cursor
def admin.constants.get_next_profile_id (   con,
  cur 
)

Definition at line 73 of file constants.py.

00073 
00074 def get_next_profile_id(con, cur):
00075     cur.execute('select max(profile_id) from profiles')
00076     profile_id = cur.fetchone()[0]
00077     
00078     if(profile_id == None):
00079         profile_id=0
00080     else:
00081         profile_id += 1
00082         
00083     return profile_id
00084 
00085 
00086 # get_wholegroup_id
00087 # From the given class_id, return it's wholegroup_id
# Params are db_connect, db_cursor, class_id
def admin.constants.get_wholegroup_id (   con,
  cur,
  class_id 
)

Definition at line 88 of file constants.py.

00088 
00089 def get_wholegroup_id(con, cur, class_id):
00090     cur.execute('SELECT wholegroup_id FROM class WHERE class_id=?',
00091                 (class_id,))
00092     return(cur.fetchone()[0])
00093 
00094 
00095 # get_class_name_for_group_id
00096 # From the given group_id, return it's class name
# Or "" if not found

Variable Documentation

Definition at line 26 of file constants.py.

Definition at line 28 of file constants.py.

Definition at line 24 of file constants.py.

Definition at line 32 of file constants.py.

Definition at line 33 of file constants.py.

Definition at line 31 of file constants.py.

Definition at line 25 of file constants.py.

Definition at line 23 of file constants.py.

Definition at line 36 of file constants.py.

Definition at line 35 of file constants.py.

Definition at line 29 of file constants.py.