MASTER INFORMATION TECHNOLOGY SOFTWARE ENGINEERING Internship report PHP WEB APPLICATION Supervisor: NGUYEN Thanh Tin Student: LY Nhat Quang HO CHI MINH CITY 12/201
MASTER INFORMATION TECHNOLOGY SOFTWARE ENGINEERING Internship report PHP WEB APPLICATION Supervisor: NGUYEN Thanh Tin Student: LY Nhat Quang HO CHI MINH CITY 12/2014
ACKNOWLEDGEMENT I express my gratitude to Mr. Nguyen Thanh Tin, my supervisor, who took the time to guide and advise me in my internship. I also want to express the welcome and the help of my colleagues: - Mr. Nguyen Thanh An - Business Analyst at Officience. We worked together on the project Hercolab. - Mr. Nguyen Tan Khoa - PHP Developer and Ms. Ngo Thi Nha Vi - Front-end Developer. We worked together on the project Hercolab. - Mr. Nguyen Le Khanh Trieu - PHP Developer, Mr. Tran Thien Binh - PHP Developer, Mr. Nguyen Huu Binh, they brought me tremendous help to solve the difficulties in PHP and Javascript. This internship Officience is an interesting experience. It allowed me to discover the functional aspect and craft PHP Developer. PHP Web Application Page a
ABSTRACT In the internship course of the Master Software Engineer program of PUF (Pôles Universitaires Franҫais), have a chance to have an internship position in Officience, I can discover the job of PHP developer. It gives me a lot of precious experiences for my future professional carrier. At Officience, I'm in R&D (Research and Development) team. The main objective is creating the products for the Company (project internal) and develop the websites open source (project external). The time of my internship is four months, from July 17, 2014 to November 24, 2014. In this time, I worked on three projects internal and one project external. This report also describes the process of implementing these projects. PHP Web Application Page b
TABLE OF CONTENTS Abstract... a Acknowledgement... b Summary... c PART A: INTRODUCTION... 1 I. About Officience... 1 1.1 Generality... 1 1.2 History and development... 1 1.3 Structure... 2 1.4 Service... 3 1.5 Customer... 3 II. About Project... 3 PART B: PERSONAL WORK... 4 I. Plan Internship... 4 II. Project Internal... 4 1. Recruitment Dashboard and Purchase Dashboard... 4 1.1 Introduction... 4 1.2 Description... 6 1.2.1 Recruitment Dashboard... 6 1.2.2 Purchase Dashboard... 8 1.2 Specification... 9 1.1.1 XML-RPC Introduction... 9 1.1.2 XML-RPC Architecture... 10 1.1.3 Using XML-RPC in project... 10 PHP Web Application Page c
2. HR Auto Send Payslip... 13 2.1 Introduction... 13 2.2 Description... 13 2.3 Specification... 16 2.3.1 PHPExcel... 16 2.2.2 PHPMailer... 17 III. Project External... 17 1. Introduction... 17 2. About Hecolab... 20 3. Specification... 20 3.1 Wordpress... 20 3.1.1 Wordpress Introduction... 20 3.1.2 Wordpress Theme Apply... 21 3.2 Q2A... 24 3.2.1 Q2A Introduction... 24 3.2.2 Q2A Theme Apply... 24 IV. Difficulties...... 27 PART C: CONCLUSION... 28 REFERENCES...... 29 PLAN OF INTERNSHIP... 30 PHP Web Application Page d
PART A: INTRODUCTION I. About Officience 1. Generality Officience is a pioneer in outsourcing services in Vietnam: Full name: Officience Vietnam Abbreviation: Officience Address : o First office: 117B Nguyen Dinh Chinh, district Phu Nhuan, Ho Chi Minh City o Second office: 161A Phan Dang Luu, district Phu Nhuan, Ho Chi Minh City Derived from Officience France (Address: 36 rue du Caire 75002 Paris) Website : www.officience.com 2. History and development Officience is a French-Vietnamese pioneer in the global outsourcing industry, being founded by Mr. Ha Duong Duc and Mr. Duong Cao Phong in 2005. After 7 years, Officience has three operational centers, two are located in Ho Chi Minh City, and one in Paris created in 2009. The number of employees has changed from 100 in 2007 to 350 in 2013. In 2012, Officience created the Center for Research and Developments (R&D). Now Officience expanded the market towards into the United States and Asia. Figure 1: History of Officience Vietnam PHP Web Application Page 1
Officience specializes in outsourcing of IT. At the request customers, we offer them solutions for image processing and data, construction of websites, online stores (e - commerce) and the consultation in other IT areas. 3. Structure Currently, Officience Vietnam has 4 departments: Process (first office): 24/7 Support, Inventory management, market watch, excel killer, order-to-bill management. Craft (first office): E-Commerce Development, PHP Development, HTML Integration, Mobile Development, SharePoint Development. Design (first office): Clipping Path, Graphic Declension, Animation, Editing. Crunch (second office): The main work: Database, Image processing. Figure 2: Structure of Officience PHP Web Application Page 2
4. Service Officience has four main services: Business Process Outsourcing (BPO) and Process Optimization: ordering & inventory management, market watch, 24/7 technical support. IT Outsourcing (ITO): web & mobile development, SharePoint solutions, software QA & testing. Content Management: digital content creation, organization & enrichment (data, text, image processing). Consulting: offshore readiness (evaluation, transition, governance). Specialties: IT outsourcing, Software development, Business Process Outsourcing, Data centre, Mobile and Web applications, Business intelligence, Content management, Web design, HTML conversion, SharePoint, Infrastructure management, SAP, Data entry, Consulting, Cloud services... 5. Customer EKINO Ekino is one of the most successful digital agencies in France. We are passionate about new technology and how it can serve today s businesses in their digital transformation. We create and maintain complex platforms (CMS, e-commerce, backend integration, ); helping our clients to deliver a seamless digital experience for their customers. And other big brands: Renault, SFR (Télécom), Le Credit Lyonnais (Banque), Crédit Agricole (Banque), Digiposte (Digital safe), FV Hospital, Astrium. II. About project In four months at Officience, I worked on 4 PHP projects: 3 projects internal and 1 project external. Project internal: - Recruitment Dashboard. - Purchase Dashboard. - HR Auto Send Payslip. Project external: Website Hercolab (Woomentum). PHP Web Application Page 3
PART B: PERSONAL WORK I. Plan Internship Time July-17-2014 From July-17 to July-25-2014 From July-28 to August-15-2014 From August-18 to August-29-2014 From September-1 to October -31-2014 From November-3 to November - 17-2014 Action First day at Officience PHP Revision Working on project Recruitment Dashboard Working on project Purchase Dashboard Working on project Hercolab Working on project HR Auto Send Payslip II. Project Internal 1. Recruitment Dashboard and Purchase Dashboard 1.1 Introduction Officience has a website "www.dinh.officience.com". This is a very important web application of the Company, is used by HR department and employees. Its functions: - HR: Management application, schedule of interview, management vacancies... - Employees: propose the requests same as purchasing working tools, expenses for business trips,..., update timesheet of the works per week... The Company needs dashboards to summary data from dinh.officience.com so I were assigned to create 2 dashboards: Recruitment Dashboard and Purchase Dashboard. PHP Web Application Page 4
Recruitment Dashboard now is used by HR department to get statistics of recruitment. Figure 3: Recruitment Dashboard interface PHP Web Application Page 5
Purchase Dashboard now is shown on a television monitor which locates at the entrance of the company for employees to track the status of their request. Figure 4: Television monitor at the entrance 1.2 Description 1.2.1 Recruitment Dashboard Dashboard includes 6 tables that show data of human resource in charts, divided into three parts: Source of Applications: has 2 tables "Source of Applications" and "Source of Recruitees". It shows the percentage of applications of one source, percentage of applications which were accepted or rejected by month and position. By that, the Human Resource Unit can find out the most effective sources to use and eliminate the ineffective sources for the cost saving. PHP Web Application Page 6
Figure 5: Source of Application tables Average time to hire position: has 2 tables "Time-To-Hire per Each Position" and "Average Time-to-Hire per Position". It shows the average duration from time open the position to time hired employee for that position and the total duration for a department. Figure 6: Average time to hire position tables Elapsed Days: has 2 tables "Elapsed Days per Position" and " Elapsed Days per BU". It shows the positions opening more than "input number" days and total number of that positions of a department. PHP Web Application Page 7
Figure 7: Elapsed days tables 1.2.2 Purchase Dashboard Dashboard has 4 tables, each table is a status of request "To Describe & Quote", "To Endorse", "To Order (GS/ITS)" and "Delivery & Payment". It shows the request, requestor and number of like. Figure 8: Purchase Dashboard interface PHP Web Application Page 8
1.3 Specification The website "www.dinh.officience.com" was built from OpenERP software, based framework OpenObject. So, to get data, we use XML- RPC method. 1.3.1 XML-RPC Introduction ML-RPC is known as a web service. Web services are a set of tools that let one build distributed applications on top of existing web infrastructures. These applications use the Web as a kind of "transport layer" but don't offer a direct human interface via the browser.[1] Extensible Markup Language (XML) provides a vocabulary for describing Remote Procedure Calls (RPC), which is then transmitted between computers using the HyperText Transfer Protocol (HTTP). Effectively, RPC gives developers a mechanism for defining interfaces that can be called over a network. These interfaces can be as simple as a single function call or as complex as a large API. XML-RPC therefore allows two or more computers running different operating systems and programs written in different languages to share processing. For example, a Java application could talk with a Perl program, which in turn talks with Python application that talks with ASP, and so on. System integrators often build custom connections between different systems, creating their own formats and protocols to make communications possible, but one can often end up with a large number of poorly documented single-use protocols. The RPC approach spares programmers the trouble of having to learn about underlying protocols, networking, and various implementation details. XML-RPC can be used with Python, Java, Perl, PHP, C, C++, Ruby, Microsoft s.net and many other programming languages. Implementations are widely available for platforms such as Unix, Linux, Windows and the Macintosh. PHP Web Application Page 9
1.3.2 XML-RPC Architecture OpenERP is a based on a client/server architecture. The server and the client(s) communicate using the XML-RPC protocol. XML- RPC is a very simple protocol which allows the client to do remote procedure calls. The called function, its arguments, and the result of the call are transported using HTTP and encoded using XML. The diagram below synthesizes the client server architecture of OpenERP. OpenERP server and OpenERP clients communicate using XML-RPC. Figure 9: XML-RPC Architecture 1.3.3 Using XML-RPC in project First, download the XML-RPC framework for PHP: xmlrpc.inc and copy it to in the php library folder. PHP Web Application Page 10
With PHP, XML-RPC has 4 main function: Connect, Search, Create and Write. But here simply use 3 functions Connect, Search and Write: Connect: connect to server. Search: get all data in a table by ID. Write: filter and get data necessary. Using XML-RPC: - Create the class Login which includes functions Connect and Search Figure 10: Function Connect PHP Web Application Page 11
Figure 11: Function Search - In the file to get data, first call the function Search to get all data. PHP Web Application Page 12
Figure 12: Call function Search to get all data with ID > 0 in table "hr.applicant" - Use function Write to filter data. Data return has the type object, so it should be converted. Figure 13: Filter and parse data 2. HR Auto Send Payslip 2.1 Introduction Each end of the month, HR department has to send manually payslips for each employee by email. This spends a lot of times. So I were assigned to create a tool that called Auto Mailer for HR to send automatically email. 2.2 Description HR department gives an excel file which contains the information of the employees same as: ID, name, position, salary, email... It is put in a directory named by format "Month Year". Auto Mailer will load the name of the directories to the drop-down list for user select. PHP Web Application Page 13
Figure 14: Drop-down list month When user selectes a month, this tool will show a table with a checkbox, name, file payslip and email of employees. Figure 15: Table employees information PHP Web Application Page 14
In the case it didn't find the file payslip of the employees, it will alert by the red color. Figure 16: Table employees information with error Then user checks in the checkbox to select an employee to send email and press submit button. After that, it will return the result "SENT" if email was sent successful and "ERROR" if it wasn t. It also save the send mail logs to file. PHP Web Application Page 15
Figure 17: Table employees information with result send mail This tool will be applied from the end of this month. 2.3 Specification Two main functions in this project is PHPExcel and PHPMailer. 2.3.1 PHPExcel PHPExcel is a great library that makes reading excel files with PHP a lot easier. PHPExcel provides several methods of reading file excel: - createreaderforfile(): automatically detect the correct reader to load the excel file. - setreaddataonly(): if we dont need any formatting on the data. - setloadallsheets():load all sheets. PHP Web Application Page 16
- getactivesheet()->toarray (): create an assoc array with the sheet name as key and the sheet contents array as value. 2.3.2 PHPMailer PHPMailer is a PHP class for PHP that provides a package of functions to send email. The two primary features are sending HTML Email and e-mails with attachments. PHPMailer supports nearly all possiblities to send email: mail(), Sendmail, qmail & direct to SMTP server. You can use any feature of SMTP-based e- mail, multiple recepients via to, CC, BCC, etc. In short: PHPMailer is an efficient way to send e-mail within PHP. PHPMailer provides several methods of sending mail: - $mail->issmtp(): sets up STMP-Server as method to send out email(s). - $mail->host = " ": sets up STMP Server. - $mail->from = " ": Enter the address that the e-mail should appear to come from. - $mail->addaddress(): add name to the from address. - $mail->addattachment(): add attachments. - $mail->ishtml(): set email format to HTML. - $mail->subject= " ": add subject of email. - $mail->body= " ": add content of email. III. Project External 1. Introduction My project external called Hercolab or Woomentum. Hercolab (or Woomentum) is a website for Question&Answer, was developed by Mr. Nguyen Le Khanh Trieu - PHP developer of Officience from June 2014. In the end of the internship, I were assigned to apply new theme for this website. PHP Web Application Page 17
Figure 18: Hercolab with old theme PHP Web Application Page 18
Figure 19: Hercolab with new theme PHP Web Application Page 19
2. About Hercolab Hercolab was founded by Mouna Aouri. Official website is www.hercolab.com Hecolab supports women in the most challenging phase of their entrepreneurial journey, the stage where it all becomes overwhelming: the transition from an idea to an actual business. It offers the space where women entrepreneurs share their challenge, give support, receive support, inspire each other and solve each other s problems. Hecolab is a platform that harnesses that powerful energy that women alone are able to create. 3. Specification The website Hecolab includes two CMS: Wordpress and Q2A. The pages: Home, Blog, Event, About us, Contact us, Register, Login, Lost Password were formed from Wordpress. The pages: Community, Ask A Question, Collaborate were formed from Q2A. 3.1 Wordpress 3.1.1 Wordpress Introduction WordPress is a free and open-source blogging tool and a content management system (CMS) based on PHP and MySQL. Features include a plugin architecture and a template system. WordPress was used by more than 23.3% of the top 10 million websites as of January 2015. WordPress is the most popular blogging system in use on the Web, at more than 60 million websites. PHP Web Application Page 20
3.1.2 Wordpress Theme Apply WordPress users may install and switch between themes. Themes allow users to change the look and functionality of a WordPress website or installation without altering the information content or structure of the site. Themes may be installed using the WordPress "Appearance" administration tool or theme folders may be uploaded via FTP.[11] The PHP, HTML (HyperText Markup Language) and CSS (Cascading Style Sheets) code found in themes can be added to or edited for providing advanced features. Thousands of WordPress themes exist, some free, and some paid for templates. WordPress users may also create and develop their own custom themes if they have the knowledge and skill to do so. To apply new theme for Wordpress, create the following files into the new theme directory: header.php: This file will contain the code for the header section of the theme. index.php: This is the main file for the theme. It will contain the code for the Main Area and will specify where the other files will be included. sidebar.php: This file will contain the information about the sidebar; footer.php: This file will handle your footer; style.css: This file will handle the styling of your new theme; In file style.css add the code below: Figure 20: Code begins file style.css PHP Web Application Page 21
Then, apply html and css. Some Wordpress pages after apply new theme: Figure 21: Register page with new theme PHP Web Application Page 22
Figure 22: Login page with new theme Figure 23: Lost Password page with new theme PHP Web Application Page 23
3.2 Q2A 3.2.1 Q2A Introduction Question2Answer (Q2A) is a popular open source Q&A platform for PHP/MySQL, currently running on 14,956 sites in 40 languages. A Q&A site helps your online community to share knowledge. People with questions get the answers they need. The community is enriched by commenting, voting, notifications, points and rankings. 3.2.2 Q2A Theme Apply Question2Answer supports multiple themes, and makes it easy for you to create your own. The HTML in its pages contains no visual formatting, so you can customize the look and feel using CSS only. To apply a new theme, I did the steps below: Choose one of Question2Answer's standard themes as a starting point. Make a copy of its directory in Q2A's qa-theme directory, and give the copy your chosen new theme name. The copied directory should at least contain the qa-styles.css file. Open file qa-style.css and add the code below: Figure 24: Code begins file qa-style.css PHP Web Application Page 24
Then, apply css into file qa-style.css and override html in file qa-theme.php Some Q2A pages after apply new theme: Figure 25: Community page with new theme PHP Web Application Page 25
Figure 26: Answer question page with new theme PHP Web Application Page 26
Figure 27: Ask a question page with new theme IV. Difficulties Inexperience is one great difficulty for me. This is the first time I expose with Wordpress and also Q2A. Further, Q2A is a new CMS with very little documentation. So, I lost a lot of times for researching and working on the project Woomentum. If I don't get the help from my team, this project can not be delivered to customer on time. PHP Web Application Page 27
PART C: CONCLUSION I did my final course of the Master Software Engineer program of PUF in Officience the company. During the four months internship, I was able to practice my theoretical knowledge acquired during my training again, I'm faced with the real problems of the working world. After my rapid integration into the team, I had the opportunity to perform many projects internal which were used by the Company and a project external which was deployed. This is one proud thing to me. In the internship, I researched about CMS: Wordpress, Q2A, learned about XML-RPC method, learned using the tools which serve for the work of an IT developer same as: SVN, Putty, FileZilla... I also had a chance to learn experience from peoples who are highly experienced in the field of programming. Now, I'm in the probation at Officience and I will try to do better in the future. Finally, I wish to express my appreciation for the opportunity to work in good conditions and a pleasant environment. PHP Web Application Page 28
REFERENCES Officience: http://www.officience.com Recruitmen Dashboard: http://www.itdevtest.officience.com/recruitmentdashboard_v2/ Purchase Dashboard: http://www.itdevtest.officience.com/purchasedashboard/ Hercolab: http://www.hercolab.com XML-RPC: http://www.php.net/manual/en/book.xmlrpc.php PHPExcel: http://www.phpexcel.codeplex.com/ PHPMailer: https://www.github.com/phpmailer/phpmailer Wordpress: http://www.wordpress.org/ Q2A: http://www.question2answer.org/ PHP Web Application Page 29