#!/usr/bin/python
import os
import re
import sys
import csv
import json
import pandas
import installLib

requiredConfigParameters = ["dataFolder"]

# Load the configuration file.
config = json.loads(installLib.readFile("config/config.json"))
for requiredConfigParameter in requiredConfigParameters:
  if not requiredConfigParameter in config.keys():
    print("Error - required value " + requiredConfigParameter + " not set in config.json.")
    sys.exit(1)
    
# Read the existing basic staff details. Headings:
# Staff: GUID,UserCode,Title,GivenName,FamilyName,DateOfBirth,Username,Identifier,Form,Role,JobTitle,TelephoneNumber
staff = pandas.read_csv(config["dataFolder"] + os.sep + "staff.csv", header=0)

# Note: staff job title and telephone number values are set in a separate script from generateBaseCSV.py and from this script to aid
# testing and debugging.
outputString = ""
for staffIndex, staffMember in staff.iterrows():
  jobTitle = str(staffMember["JobTitle"])
  telephoneNumber = str(staffMember["TelephoneNumber"])
  if not "nan" in [jobTitle, telephoneNumber]:
    os.system("gam user " + staffMember["Username"] + "@knightsbridgeschool.com signature file config/emailSignature/emailSignature.html html replyto " + staffMember["Username"] + "@knightsbridgeschool.com replace email \"" + staffMember["Username"] + "@knightsbridgeschool.com\" replace name \"" + staffMember["GivenName"] + " " + staffMember["FamilyName"] + "\" replace title \"" + staffMember["JobTitle"] + "\" replace telephone \"" + staffMember["TelephoneNumber"] + "\"")
Пример #2
0
        for resultItem in result:
            for splitItem in resultItem.split(theSplit[pl]):
                tempResult.append(splitItem.strip())
        result = tempResult
    return result


def getValue(theXMLNode, theTag):
    findResult = theXMLNode.find(theTag)
    if findResult == None:
        return ""
    return findResult.text


# Load the configuration file.
config = json.loads(installLib.readFile("config/config.json"))
for requiredConfigParameter in requiredConfigParameters:
    if not requiredConfigParameter in config.keys():
        print("Error - required value " + requiredConfigParameter +
              " not set in config.json.")
        sys.exit(1)

iSAMSXML = xml.etree.ElementTree.fromstring(
    installLib.readFile("iSAMSData.xml"))

# Get a list of Yeargroups / Form / Teaching Sets from iSAMS.
for currentSet in iSAMSXML.findall("./TeachingManager/Sets/Set"):
    print(currentSet.find("SetCode").text)

# Staff - previous output format:
# StaffID,Title,GivenName,FamilyName,DateOfBirth,Username,Identifier,Form,JobTitle