TeamWox HelpService DeskPublic ComponentPHP Example

Example of Public Component in PHP

In this section the detailed example of designing the public part of the "Service Desk" module using the PHP language is given.

<?php
//--- get user details from cache or DB
$user_info = array('id'=>1,
                'name'=>'My name',
                'email'=>'test@test.com',
                'company'=>'My company');
?>
<script type="text/javascript">
var tw_servicedesk_params=<?php echo json_encode(array(   // for outputting use the function of outputting with screening of special symbols
   //---
   'url'         =>'https://team.yourdomain.com',         // domain name of your TeamWox
   //---
   'sid'         =>md5("Change_This_Secret_Word_".$user_info['id']), // hash from the line: keyword + identifier of website user
   'container'   =>'service_desk',                        // identifier of HTML element (fro example, <div>),
   //---                                                  //      the list of request will be displayed in
   'user_name'   =>$user_info['name'],                    // name of website user
   'user_email'  =>$user_info['email'],                   // e-mail of website user
   'user_company'=>$user_info['company'],                 // name of company of website user
   //---
   'incidents_per_page'=>15,                              // number of requests displayed at one page
   'comments_per_page' =>20,                              // number of comments displayed at one page
   'filter_groups'     =>array(1003,1004,1007),           // identifiers of service groups at Service Desk in TeamWox
   'filter_products'   =>array(1020,1023),                // identifiers of products in groups at Service Desk in TeamWox
   'filter_categories' =>array(2003,2007,2011),           // identifiers of categories in groups at Service Desk in TeamWox
   //---
   'logo'              =>'<img src="http://www.yourwebsite.com/company_logo.gif"
                           title="Your Company Name" alt="Your Company Name"/>',
));
?>;
</script>

This example is intended for PHP version 5.2 or higher.


← SID .NET Example →