phpDocumentor Developer
[ class tree: Developer ] [ index: Developer ] [ all elements ]

Class: Device_welcomeletter

Source Location: /devices/welcomeletter/welcomeletter.php

Class Device_welcomeletter

Class Overview

This is the main implementation class of the module

The class should only define one public method: writeInstaller.

All other methods and properties should be private. This example sets zipInstaller method to protected, so that it can be seen in the documentation.

Located in /devices/welcomeletter/welcomeletter.php [line 34]

DeviceConfig
   |
   --Device_welcomeletter
Author(s): Information Tags:

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From DeviceConfig

DeviceConfig::$attributes
DeviceConfig::$device_id
DeviceConfig::$FPATH
DeviceConfig::$installerBasename
DeviceConfig::$lang_index
DeviceConfig::$module_path
DeviceConfig::$options
DeviceConfig::$selected_eap
DeviceConfig::$sign
DeviceConfig::$signer
DeviceConfig::$specialities
DeviceConfig::$support_email_substitute
DeviceConfig::$support_url_substitute

Inherited From DeviceConfig

DeviceConfig::__construct()
device module constructor should be defined by each module, but if it is not, then here is a default one
DeviceConfig::copyFile()
Copy a file from the module location to the temporary directory.
DeviceConfig::dumpAttibutes()
dumps attributes for debugging purposes
DeviceConfig::getPreferredEapType()
Selects the preferred eap method based on profile EAP configuration and device EAP capabilities
DeviceConfig::saveCertificateFiles()
Save certificate files in either DER or PEM format
DeviceConfig::setup()
Set up working environment for a device module
DeviceConfig::translateFile()
Copy a file from the module location to the temporary directory aplying translation.
DeviceConfig::translateString()
DeviceConfig::writeDeviceInfo()
prepare usage information for the installer every device module should override this method
DeviceConfig::writeInstaller()
placeholder for the main device method

[ Top ]
Method Summary
Device_welcomeletter   __construct()  
void   writeDeviceInfo()  
void   writeInstaller()   prepare a zip archive containing files and settings which normally would be used inside the module to produce an installer

[ Top ]
Methods
Constructor __construct  [line 36]

  Device_welcomeletter __construct( )


API Tags:
Access:  public


Redefinition of:
DeviceConfig::__construct()
device module constructor should be defined by each module, but if it is not, then here is a default one

[ Top ]
writeDeviceInfo  [line 162]

  void writeDeviceInfo( )


API Tags:
Access:  public


Redefinition of:
DeviceConfig::writeDeviceInfo()
prepare usage information for the installer every device module should override this method

[ Top ]
writeInstaller  [line 53]

  void writeInstaller( )

prepare a zip archive containing files and settings which normally would be used inside the module to produce an installer

  1. function writeInstaller({
  2.         /** run innitial setup
  3.           this will:
  4.           - create the temporary directory and save its path as $this->FPATH
  5.           - process the CA certificates and store results in $this->attributes['internal:CAs'][0]
  6.           $this->attributes['internal:CAs'][0] is an array of processed CA certificates
  7.           a processed certifincate is an array
  8.           'pem' points to pem feromat certificate
  9.           'der' points to der format certificate
  10.           'md5' points to md5 fingerprint
  11.           'sha1' points to sha1 fingerprint
  12.           'name' points to the certificate subject
  13.           - save the info_file (if exists) and put the name in $this->attributes['internal:info_file_name'][0]
  14.          */
  15. //    $this->supportedEapMethods = Device_welcomeletter::$my_eap_methods;
  16.  
  17.         debug(4"mobileconfig Module Installer start\n");
  18.  
  19.         $this->copyFile('welcomeletter.odt');
  20.  
  21.         $o system('unzip -q -d ./ welcomeletter.odt');
  22.  
  23.         $source_content fopen('content.xml''r+');
  24.         $source_styles fopen('styles.xml''r+');
  25.  
  26.         $content fread($source_content1000000);
  27.         $style fread($source_styles1000000);
  28.  
  29.         ftruncate($source_content0);
  30.         ftruncate($source_styles0);
  31.         /// welcomletter: header of document
  32.         $style preg_replace('/XXXDOCUMENT_HEADXXX/'_("Welcome Letter")$style);
  33.         /// welcomletter: footer
  34.         $style preg_replace('/XXXFOOTERXXX/'_("eduroam® - supporting academic mobility since 2003"),$style);
  35.         /// welcomeletter: the headline (bold, large)
  36.         $content preg_replace('/XXXDOCUMENT_HEADLINEXXX/'_("Welcome aboard the eduroam® user community!")$content);
  37.         /// welcomeletter: initial greeting
  38.         $content preg_replace('/XXXDOCUMENT_USERGREETXXX/'sprintf(_("Dear user from %s,")$this->attributes['general:instname'][0])$content);
  39.         /// welcomeletter: sales pitch paragraph :-)
  40.         $content preg_replace('/XXXDOCUMENT_SALESPITCHXXX/'_("we would like to warmly welcome you among the several million users of eduroam®! From now on, you will be able to use internet access resources on thousands of universities, research centres and other places all over the globe. All of this completely free of charge!")$content);
  41.         /// welcomeletter: log in now paragraph
  42.         $content preg_replace('/XXXDOCUMENT_LOGINXXX/'_("Now that you have downloaded and installed a client configurator, all you need to do is find an eduroam® hotspot in your vicinity and enter your user credentials (this is our fancy name for 'username and password' or 'personal certificate') - and be online!")$content);
  43.         /// welcomeletter: explain support procedure
  44.         $content preg_replace('/XXXDOCUMENT_SUPPORTPROCEDUREXXX/'sprintf(_("Should you have any problems using this service, please always contact the helpdesk of %s. They will diagnose the problem and help you out. You can reach them via the means below:")$this->attributes['general:instname'][0])$content);
  45.         /// welcomeletter: explain manual config
  46.         $content preg_replace('/XXXDOCUMENT_MANUALADVICEXXX/'_("If you ever need to configure a different device for eduroam manually, you will need the configuration information for your institution. We have summarised this information in the appendix on page 2 for you.")$content);
  47.         /// welcomeletter: have fun
  48.         $content preg_replace('/XXXHAVEFUNXXX/'_("We wish you a lot of fun on eduroam® hotspots all over the planet.")$content);
  49.         /// welcomeletter: title of the big boss
  50.         $content preg_replace('/XXXBOSS_DESIGNATIONXXX/'_("Chairman of the Global eduroam® Governance Committee")$content);
  51.         /// welcomeletter: header: appendix with config info
  52.         $content preg_replace('/XXXHEADER_CONFIGAPPENDIXXXX/'_("Appendix: Configuration Information"),$content);
  53.         /// welcomeletter: header: appendix with config info
  54.         $content preg_replace('/XXXCONFIGAPPENDIXXXX/'sprintf(_("Use the information below to configure your devices manually. Please keep in mind that these settings are only valid for users of profile '%s' from %s – they are different for everyone else, and there is no use sharing them with other people."),$this->attributes['profile:name'][0],$this->attributes['general:instname'][0]),$content);
  55.         $helpdesktext "";
  56.         if ($this->attributes['support:email'])
  57.             foreach ($this->attributes['support:email'as $number => $option)
  58.                 $helpdesktext .= _("E-Mail:")." <text:span text:style-name=\"T2\">" $option "</text:span></text:p><text:p style-name=\"Standard\">";
  59.  
  60.         if (isset($this->attributes['support:eap_types']))
  61.             foreach ($this->attributes['support:eap_types'as $number => $option)
  62.                 $helpdesktext .= _("Special EAP Type support URL:")." <text:span text:style-name=\"T1\">" $option "</text:span></text:p><text:p style-name=\"Standard\">";
  63.  
  64.         if (isset($this->attributes['support:phone']))
  65.             foreach ($this->attributes['support:phone'as $number => $option)
  66.                 $helpdesktext .= _("Phone:")." <text:span text:style-name=\"T2\">" $option "</text:span></text:p><text:p style-name=\"Standard\">";
  67.  
  68.         if (isset($this->attributes['support:url']))
  69.             foreach ($this->attributes['support:url'as $number => $option)
  70.                 $helpdesktext .= _("Web:")." <text:span text:style-name=\"T2\">" $option "</text:span></text:p><text:p style-name=\"Standard\">";
  71.  
  72.         $content preg_replace('/XXXHELPDESKMAILXXX/'$helpdesktext$content);
  73.  
  74.         $eapinfo "";
  75.         if (isset($this->attributes['eap:server_name']))
  76.             foreach ($this->attributes['eap:server_name'as $number => $option)
  77.                 $eapinfo .= _("Server Name:")." <text:span text:style-name=\"T2\">" $option "</text:span></text:p><text:p style-name=\"Standard\">";
  78.  
  79.         $content preg_replace('/XXXEAPINFOXXX/'$eapinfo$content);
  80.  
  81.  
  82.         /*    if ($this->attributes['support:eap_types'])
  83.           foreach ($this->attributes['support:eap_types'] as $number => $option)
  84.           $helpdesktext .= "Special EAP Type support URL: <text:span text:style-name=\"T1\">".$option."</text:span></text:p><text:p style-name=\"Standard\">";
  85.           if ($this->attributes['support:phone'])
  86.           foreach ($this->attributes['support:phone'] as $number => $option)
  87.           $helpdesktext .= "Phone: <text:span text:style-name=\"T2\">".$option."</text:span></text:p><text:p style-name=\"Standard\">";
  88.           if ($this->attributes['support:url'])
  89.           foreach ($this->attributes['support:url'] as $number => $option)
  90.           $helpdesktext .= "Web: <text:span text:style-name=\"T2\">".$option."</text:span></text:p><text:p style-name=\"Standard\">";
  91.          */
  92.  
  93.         fseek($source_content0SEEK_SET);
  94.         fwrite($source_content$content);
  95.         fclose($source_content);
  96.  
  97.         fseek($source_styles0SEEK_SET);
  98.         fwrite($source_styles$style);
  99.         fclose($source_styles);
  100.  
  101.         $o system('zip -q welcomeletter.odt * -x local-info.* -x logo*.*');
  102.         // openoffice needs to be running on headless TCP/8100 mode on the system...
  103.         // python needs to be python2.7
  104.         //$o2 = system('python /root/DocumentConverter.py '.$this->FPATH.'/welcomeletter.odt '.$this->FPATH.'/welcomeletter.pdf');
  105.         $e $this->installerBasename.'.odt';
  106.         rename("welcomeletter.odt",$e);
  107.         return $e;
  108.     }


API Tags:
Access:  public


Redefinition of:
DeviceConfig::writeInstaller()
placeholder for the main device method

[ Top ]

Documentation generated on Wed, 08 Apr 2015 07:12:46 +0000 by phpDocumentor 1.4.4