.


:




:

































 

 

 

 


(. framework) ()




; , . , , . , , , .

, : , , , , ( ).

 

2.3.1 PHP-.

PHP- -. , , . , , . -, .

, PHP- .

PHP- Model View Controller (MVC). MVC , - , , .

, , , , . .

MVC, : Model , , View , , , ontroller , . MVC. Front Controller, , , . Front Controller [22].

 

2.3.2 PHP-

, . PHP- , . PHP, .

. , . , , , PHP- , .

 

2.3.3

, , 6 PHP-, .

Zend framework

Zend framework PHP-framework, Zend, PHP. PHP , - , agile [23].

:

PHP 5 E_STRICT ;

;

, ;

MVC, PHP- ;

, MariaDB, MySQL, Oracle, IBM DB2, Microsoft SQL Server, PostgreSQL, SQLite, and Informix Dynamic Server;

, , email mbox, Maildir, POP3 IMAP4;

.

:

;

;

;

, ;

;

;

.

 

CakePHP

CakePHP PHP, , -. MVC, - .

CakePHP . Ruby on Rails, [24].

:

, (ACL), , cookies, ( Nested Sets);

() , (paginate), , JavaScript ( AJAX);

;

SQL-, , ORM;

CRUD- , Router::mapResources c Put Delete Get Post;

Bake;

;

, Shell Task;

( ), ;

Simple Test;

(layouts) (Themes);

( Ruby On Rails).

:

;

;

;

ACL;

;

.

Kohana

Kohana PHP- CodeIgniter Blue Flame. , , CodeIgniter. Rick Ellis CodeIgniter . 2007 Blue Flame Kohana, [25].

:

;

;

;

MVC;

UTF-8;

;

BSD, , .

:

, ;

;

, IRC;

, ;

.

 

CodeIgniter

CodeIgniter MVC , PHP, - . EllisLab, (Rick Ellis) (Paul Burdick) [26].

CodeIgniter , :

;

;

, ;

;

CodeIgniter , PHP 5.1 ;

CodeIgniter ;

MySQL, PostgreSQL, MSSQL, SQLite, Oracle.

:

PHP4 ;

;

;

CSRF-.

 

 

Symfony

Symfony PHP , , PHP5. , -. Symfony , PHP5, Model-View-Controller (MVC). Symfony -, -. Symfony MIT [27].

:

(MySQL, PostgreSQL, SQLite PDO- );

email;

;

;

Sensio;

;

.

:

;

;

;

ORM;

.

Yii

Yii , PHP- -. -. Yes It Is [22].

:

;

DAO ActiveRecord (PDO);

;

;

;

;

AJAX jQuery;

PHP- CRUD- ();

;

;

;

;

REST.

.

 

2.3.4

1. .

2. .

3. .

4. -. , , . - .

5. .

6. , .

7. , .

8. , .

9. , , .

.

. (, twitter.com, , ..) CMS . .

 

2.3.5

Yii.

Yii , . :

;

;

, ;

javascript jQuery;

: Data Access Objects, Active Record;

Gii;

 

2.4

 

, . [28]. PHP-.

.

(): ( ) , . - ;

(in-memory databases): ;

(tertiary databases): ( ). , ; .

(SQL) , . MySQL. MySQL .

2.4.1 MySQL

MySQL .

MySQL[29]:

. MySQL . .

˸ . MySQL . , Linux .

. MySQL .

. MySQL A B , . .

. MySQL , , , MySQL.

MySQL . mysql, MySQL AB MySQL. phpMyAdmin, , .

 

2.5

 

() , , [30]

, , , , , , . . , , , .

, (.2.3).

. 2.3

. . , . , . . , , .

 

2.3

 

. , , . , , .

, , -, , , .

Git

Git , Git . Git . Git , . , Git , .

. , .

Git - , [30].

 

2.6 Bootstrap

 

Bootstrap Twitter, Twitter Bootstrap, , Twitter.

Bootstrap CSS/HTML . , . , BS [31].

Bootstrap

1. , , Bootstrap .

2. : .

3. ˸ : css-, .

4. .

5. Bootstrap CMS (OpenCart, Prestashop, Magento, Joomla, Bitrix, WordPress ), .

Bootstrap . ( , ). Bootstrap : CSS .

2.7 Highcharts

 

Highcharts , JavaScript, , -. : , , , [32].

, Safari iPhone.

Internet Explorer 6+. , Canvas-, SVG .

, $80, 360 .

:
line, spline, area, areaspline, column, bar, pie scatter. , .

JS, , .
:

JS - Flash;

, -;

;

/ ;

tooltip ;

date-time X-;

~18.

 

 

 


 

3.

 

PHP c Yii Bootstrap Highcharts, :

1. .

2. .

3. .

¸ Bootstrap. HighCharts.

Synergy . . . . . .

 

3.1

 

: SiteController.php, LoginForm.php, RegistrationForm.php, activate.php, login.php, registration.php, registrationSuccess.php (. 1). ( 3.1, 3.2).

(. 3.3.)

(. 3.4).

. 3.1

 

. 3.2


 

. 3.3

. 3.4

.3.5.

. 3.5

, (. 3.6), (. 3.7).

. 3.6

. 3.7

 

3.2

 

: UsersController.php, Users.php, index.php, form.php (. 1). (.3.8), , , , .

. 3.9.

. : TasksController.php, Task.php, TaskData.php, index.php, tabs.php, result.php, form.php, form2.php, form3.php. , , (. 3.10 3.13). . . .

. 3.8

 

 

. 3.9

 

. 3.10

 

. 3.11 .

.3.12 .

. 3.13 .

 

 

3.3

HighCharts, . .

result.php , . - . . 3.14 3.15.

. 3.14

 

. 3.15 .

 


 

4.

4.1

Yii. .

Yii . , (web-), .

, . web-, html, web-. , , . .

 

4.2

Synergy . . . . .

 

4.3

, Yii , . Yii web-, , (. 4.1). , c .

. 4.1 Yii

1. URL http://www.cloudsim.com/index.php?r=post/show&id=1, - , index.php.

2. .

3. request.

4. urlManager. post, PostController, show, .

5. . show actionShow . (, access control, benchmarking), , , , .

6. Post ID 1.

7. show, Post.

8. Post.

9. .

10. .

11. .

 

4.4

 

2- 1.9 ;

: Linux, Windows;

8 ;

: Apache, MySQL, PHP, Yii, PHPSTORM, Git;

:

1.9 ;

, http;

Web-;

 

4.5

, web- HTML5, JavaScript CSS. web-, . .

 

4.6

. 4.1.

. 4.1

: SiteController.php, LoginForm.php, RegistrationForm.php, activate.php, login.php, registration.php, registrationSuccess.php, UsersController.php, Users.php, index.php, form.php, TasksController.php, Task.php, TaskData.php, index.php, tabs.php, result.php, form.php, form2.php, form3.php.

. 4.2.

. 4.2

 

: SiteController.php, LoginForm.php, RegistrationForm.php, activate.php, login.php, registration.php, registrationSuccess.php, UsersController.php, Users.php, index.php, form.php, TasksController.php, Task.php, TaskData.php, index.php, tabs.php, result.php, form.php, form2.php, form3.php.

(c. 3.1) : UsersController.php, RegistrationForm.php, registration.php. Users, MySQL.

(c. 3.3) : registrationSuccess.php.

(c. 3.4) : activate.php.

(c. 3.5) : UsersController.php, LoginForm.php, login.php. Users, email password .

(c. 3.6) : UsersController.php, update.php. . Users name.

(c. 3.7) : ProfileController.php, changePassword.php. . Users password.

(c. 3.8) : UsersController.php, Users.php. . Users : name, email, password, role.

(c. 3.9) : UsersController.php, Users.php, index.php.

(c. 3.10) : TasksController.php, Task.php, index.php. Task : name, type, status, created.

(c. 3.11-3.15) : TasksController.php, Task.php, tabs.php, form.php, form2.php, form3.php.

Task_data, : task_id, description, index_nano_n, index_nano_m, length_link, indent_radius_inside, indent_radius_outwards, nuclear_charge, valence_electrons, s_orbital, p_orbital, d_orbital, f_orbital, g_orbital, auto_calculate, max_energy, accuracy_calculation, number_points, calculation_zone, max_energy_graph, min_energy_graph, time_calculation.

 

5

5.1

Synergy . . . . .

 

5.2

web-, .

. . , .

 

5.3

web-. web- , . , ( , ). , :

, .

, , , .

 

5.4

, , .

:

email => E-mail,

password =>

LoginForm.php.

:

name => ,

email => E-mail,

password => ,

password2 =>

RegistrationForm.php.

:

id => ID,

users_id => ,

name => ,

type => ,

status => ,

created => ,

Task.php.

:

id => ID,

task_id => Task,

description => ,

index_nano_n => N,

index_nano_m => M,

length_link => -,

indent_radius_inside => ,

indent_radius_outwards => ,

nuclear_charge => ,

valence_electrons => ,

s_orbital => s ,

p_orbital => p ,

d_orbital => d ,

f_orbital => f ,

g_orbital => g ,

auto_calculate => ,

max_energy => , ( ),

accuracy_calculation => 1,

number_points => ,

calculation_zone => (-pi/c -pi/c),

max_energy_graph => ,

min_energy_graph => ,

time_calculation => (),

TaskData.php.

:

id => ID,

created => ,

email => Email,

name => ,

password => ,

oldPassword => ,

newPassword => ,

verifyPassword => ,

role => ,

Users.php.

, , .

:

id => ID,

task_id => Task,

description => ,

index_nano_n => N,

index_nano_m => M,

length_link => -,

indent_radius_inside => ,

indent_radius_outwards => ,

nuclear_charge => ,

valence_electrons => ,

s_orbital => s ,

p_orbital => p ,

d_orbital => d ,

f_orbital => f ,

g_orbital => g ,

auto_calculate => ,

max_energy => , ( ),

accuracy_calculation => 1,

number_points => ,

calculation_zone => (-pi/c -pi/c),

max_energy_graph => ,

min_energy_graph => ,

time_calculation => (),

TaskData.php.

 

 

:

Ø PHP

Ø Yii

Ø Bootstrap

Ø Highcharts

, :

;

;

.

 

 


 

 

1. . ., . . . . // . . 2003 . 55.

2. . [ ]. : http://swsysweb.ru/cloudcomputingbasicconceptsproblems.html ( : 3.05.2015).

3. A Report of The National Science Foundation Advisory Committee for Cyberinfrastructure Task Force on Grand Challenges, Final Report, March 2011 // nsf.gov [ ]. URL: http://www.nsf.gov/cise/aci/taskforces/TaskForceReport_GrandChallenges.pdf ( : 04.04.2015).

4. Armbrust M. et al. A view of cloud computing //Communications of the ACM. 2010. Vol. 53. . 4. P. 4959.

5. nanoHUB. [ ]. : https://nanohub.org/ ( : 8.05.2015).

6. Buyya R. et al. High Performance Cluster Computing: Architectures and Systems (Volume 1) //Prentice Hall, Upper SaddleRiver, NJ, USA. 1999. Vol. 1. 849 p

7. Top500 // top500.org [ ]. : http://www.top500.org/statistics/list/ ( : 9.05.2015).

8. [ ]. : http://ikt.muctr.ru/index.php ( : 11.05.2015).

9. . ., . . : // . 2006. . 1. . 3.

10. Lin J. et al. What is Cloud Computing? //IT as a Service. 2009. Vol. 11. . 2. P. 1013.

11. Mell P., Grance T. The NIST definition of cloud computing //National Institute of Standards and Technology. [ ]. : http://csrc.nist.gov/publications/nistpubs/800145/SP800145.pdf ( : 11.05.2015).

12. NanoCloud [ ]. : http://www.nanocloud.su ( 12.05.2015)

13. . ., . ., . . // : : (. , 1924 2011 .). .: . 2011.

14. CLAVIRE. [ ]. : http://clavire.ru/ ( : 15.05.2015).

15. - ӻ. [ ]. : http://supercomputer.susu.ru/computers/skif_avrora/ ( : 15.05.2015).

16. . [ ]. : http://supercomputer.susu.ru/computers/skif_ural ( : 15.05.2015).

17. . . Linux: . / . . .: ֖ 2007. 288

18. .. : Ubuntu /. /.: , 2010. 160.

19. . Ubuntu : . . .: ; .: , 2011. 464

20. , , , . Unix Linux: , 4- .: . . .: .. . 2012. 1312

21. .., ... Linux-: . .: - , 2003. 572.

22. Yiiframework [ ]. : http://www.yiiframework.com/doc/guide/1.1/ru/ ( : 15.05.2015).

23. Zendframework[ ]. : http://zendframework.ru/ ( : 16.05.2015).

24. Cakephp [ ]. : http://cakephp.org/ ( : 16.05.2015).

25. Kohana [ ]. : https://kohanaframework.org/ ( : 16.05.2015).

26. Codeigniter [ ]. : http://codeigniter.ru/ ( : 16.05.2015).

27. Symfony[ ]. : https://symfony.com/ ( : 16.05.2015).

28. .. . [ ]. : http://www.apmath.spbu.ru/ru/education/final/question43new.pdf ( : 15.04.2015).

29. , . . MySQL/ . . .: ; 2007. 554.

30. Git [ ]. : https://git-scm.com/book/ru ( : 19.05.2015).

31. Bootstrap [ ]. : http://mybootstrap.ru/ ( : 19.05.2015).

32. Highcharts [ ]. : http://mybootstrap.ru/ ( : 19.05.2015).


 

 

 


 

1.

 

controllers/SiteController.php

<?php

 

class SiteController extends UController

{

public function actionIndex()

{

if ($this->getUser()->isGuest()) {

$this->redirect(array('login'));

} else {

$this->redirect(Yii::app()->homeUrl);

}

}

 

public function actionError()

{

if($error=Yii::app()->errorHandler->error)

{

if(Yii::app()->request->isAjaxRequest)

echo $error['message'];

else

$this->render('error', $error);

}

}

 

public function actionLogin()

{

$model = new LoginForm;

 

if (isset($_POST['LoginForm'])) {

$model->attributes = $_POST['LoginForm'];

if ($model->validate() && $model->login()) {

$this->redirect(Yii::app()->user->returnUrl);

}

}

$this->render('login', compact('model'));

}

 

public function actionRegistration()

{

$model = new RegistrationForm;

 

$this->performAjaxValidation($model);

 

if ($model->getFormData()) {

$model->attributes = $model->getFormData();

if ($model->validate() && $model->registration()) {

$this->setFlash('success', " ");

$this->redirect(array('registrationSuccess'));

} else {

$this->setFlash('error', ACTION_VALIDATE_ERROR);

HDev::log($model->errors);

}

}

$this->render('registration', compact('model'));

 

 

}

 

public function actionRegistrationSuccess()

{

$this->render('registrationSuccess');

}

 

public function actionActivate($key)

{

/** @var Users $model */

$model = Users::model()->findByAttributes(array('activation_key' => $key));

if (!$model) {

throw new CHttpException(404, ' ');

}

 

$model->status = 1;

if (!$model->save()) {

HDev::logSaveError($model);

}

$this->render('activate');

}

 

 

public function actionLogout()

{

Yii::app()->user->logout();

$this->redirect(Yii::app()->homeUrl);

}

 

 

}

models/form/LoginForm.php

<?php

 

class LoginForm extends CFormModel

{

 

public $email;

public $password;

 

private $_identity;

 

public function rules()

{

return array(

array('email, password', 'required'),

array('email', 'email'),

);

}

 

public function setUser(Users $user) {

$this->email = $user->email;

$this->password = $user->password;

}

 

public function login()

{

if ($this->_identity === null) {

$this->_identity = new UUserIdentity($this->email,$this->password);

$this->_identity->authenticate();

}

 

if ($this->_identity->errorCode === UUserIdentity::ERROR_NONE) {

Yii::app()->user->login($this->_identity, 3600 * 24 * 365 * 10);

return true;

}

elseif ($this->_identity->errorCode === UUserIdentity::ERROR_USERNAME_INVALID) {

$this->addError('email', ' ');

}

elseif ($this->_identity->errorCode === UUserIdentity::ERROR_PASSWORD_INVALID) {

$this->addError('password', ' ');

}

 

return false;

}

 

public function attributeLabels()

{

return array(

'email' => 'E-mail',

'password' => '',

);

}

 

}

models/form/RegistrationForm.php

<?php

 

class RegistrationForm extends UFormModel

{

public $name;

public $email;

public $password;

public $password2;

 

private $_identity;

 

public function rules()

{

return array(

array('name, email, password, password2', 'required'),

array('password2', 'compare', 'compareAttribute' => 'password'),

array('email', 'email'),

array('email', 'unique', 'className' => 'Users', 'attributeName' => 'email'),

);

}

 

public function setUser(Users $user) {

$this->email = $user->email;

$this->password = $user->password;

 

}

 

public function registration()

{

$model = new Users();

 

/* */

$model->email = $this->email;

$model->name = $this->name;

$model->password = $this->password;

$model->role = UserRole::USER;

//$model->name = (string) str_replace(" ","",$_POST['Users']['name']);

//$model->role = (int) 1;

/* */

if(!$model->save()) {

HDev::logSaveError($model);

return false;

}

 

 

return true;

 

 

// return true;

}

 

public function attributeLabels()

{

return array(

'name' => '',

'email' => 'E-mail',

'password' => '',

'password2' => ' ',

);

}

 

}

 

views/site/login.php

<?php

/**

* @var $this UController

* @var $model LoginForm

*/

 

$this->pageTitle = '';

 

$this->widget('TbAlert');

 

/** @var TbActiveForm $form */

$form = $this->beginWidget(BS_ActiveForm, array(

'layout' => TbHtml::FORM_LAYOUT_HORIZONTAL,

'enableAjaxValidation' => true,

'enableClientValidation' => true,

));

 

echo $form->textFieldControlGroup($model, 'email');

echo $form->passwordFieldControlGroup($model, 'password');

 

echo TbHtml::formActions(array(

TbHtml::submitButton('', array('color' => TbHtml::BUTTON_COLOR_SUCCESS)),

TbHtml::linkButton('', array('url' => '/site/registration', 'color' => TbHtml::BUTTON_COLOR_PRIMARY)),

));

$this->endWidget();

 

views/site/registration.php

<?php

/**

* @var $this UController

* @var $model LoginForm

*/

 

$this->pageTitle = '';

 

$this->widget('TbAlert');

 

/** @var TbActiveForm $form */

$form = $this->beginWidget(BS_ActiveForm, array(

'layout' => TbHtml::FORM_LAYOUT_HORIZONTAL,

'enableAjaxValidation' => true,

'enableClientValidation' => true,

));

echo $form->textFieldControlGroup($model, 'name');

echo $form->textFieldControlGroup($model, 'email');

echo $form->passwordFieldControlGroup($model, 'password');

echo $form->passwordFieldControlGroup($model, 'password2');

 

 

echo TbHtml::formActions(array(

TbHtml::submitButton('', array('color' => TbHtml::BUTTON_COLOR_SUCCESS)),

));

$this->endWidget();

 

views/site/registrationSuccess.php

<?php

/**

* @var $this UController

* @var $model LoginForm

*/

 

$this->pageTitle = ' ';

 

$this->setFlash('success', ' .');

 

$this->widget('TbAlert');

views/site/activate.php

<?php

/**

* @var $this UController

* @var $model Users

*/

 

$this->pageTitle = ' ';

 

$this->setFlash('success', ' email .');

 

$this->widget('TbAlert');

 

controllers/UserController.php

<?php

 

class UsersController extends UController

{

 

public function filters()

{

return array(

'accessControl',

);

}

 

public function accessRules()

{

 

return array(

array(

'allow',

'users' => array(UserAccessTypes::AUTH),

'expression' => function(UWebUser $user) {

// - ()

return $user->getModel()->isAdmin();

}

),

array('deny'),

);

}

 

 

public function actionIndex()

{

$model = new Users('search');

$model->unsetAttributes();

if ($model->getQueryData()) {

$model->attributes = $model->getQueryData();

}

 

$this->pageTitle='';

$this->breadcrumbs= array($this->pageTitle);

 

$this->render('index', compact('model'));

}

 

public function actionCreate()

{

$model = new Users();

 

$this->performAjaxValidation($model);

 

if ($model->getFormData()) {

$model->attributes = $model->getFormData();

 

if($model->save()) {

$this->setFlash('success', ACTION_CREATE_SUCCESS);

$this->redirect(array('index'));

} else {

$this->setFlash('error', ACTION_VALIDATE_ERROR);

HDev::log($model->getErrors());

}

}

 

$this->pageTitle=' ';

 

$this->breadcrumbs = array(

'' => array('index'),

$this->pageTitle

);

 

$this->render('form', compact('model'));

}

 

public function actionUpdate($id)

{

$model = $this->loadModel($id);

 

$this->performAjaxValidation($model);

 

if ($model->getFormData()) {

$model->attributes = $model->getFormData();

 

if($model->save()) {

$this->setFlash('success', ACTION_CREATE_SUCCESS);

$this->redirect(array('index'));

} else {

$this->setFlash('error', ACTION_VALIDATE_ERROR);

HDev::log($model->getErrors());

}

}

 

$this->pageTitle=' ';

 

$this->breadcrumbs = array(

'' => array('index'),

$this->pageTitle

);

 

$this->render('form', compact('model'));

}

 

public function actionDelete($id)

{

$model = $this->loadModel($id);

 

if (Yii::app()->user->id == $model->id)

throw new CHttpException(403, ' - .');

 

$model->delete();

}

 

/**

* @param $id

* @return Users

* @throws CHttpException

*/

protected function loadModel($id)

{

$model = Users::model()->findByPk($id);

if (!$model)

throw new CHttpException(404, ' ');

 

return $model;

}

 

public function actionLogin($id)

{

$virtualModeOwner = Yii::app()->user->id;

 

$this->virtualMode($id, $virtualModeOwner);

 

Yii::app()->controller->redirect(Yii::app()->homeUrl);

}

 

public function actionLogout()

{

$id = Yii::app()->user->getState('virtualModeOwner');

 

$this->virtualMode($id, false);

 

Yii::app()->controller->redirect(Yii::app()->homeUrl);

}

 

 

/**

* @param integer $loginUserId

* @param mixed $virtualModeOwner - id of owner or false

* @return bool

*/

private function virtualMode($loginUserId, $virtualModeOwner)

{

$identity=new UUserIdentity("","",$loginUserId);

$identity->authenticate();

 

if($identity->errorCode===UUserIdentity::ERROR_NONE)

{

if ($virtualModeOwner) {

$identity->setVirtualMode($virtualModeOwner);

}

 

Yii::app()->user->logout();

 

$result = Yii::app()->user->login($identity);

 

return $result;

}

 

return false;

 

}

}

models/Users.php

<?php

 

/**

* This is the model class for table "users".

*

* The followings are the available columns in table 'users':

* @property integer $id

* @property string $created

* @property string $email

* @property string $name

* @property string $password

* @property string $role

* @property string $status

* @property string $activation_key

*/

class Users extends UActiveRecord

{

public $oldPassword;

public $newPassword;

public $verifyPassword;

 

/**

* @return string the associated database table name

*/

public function tableName()

{

return 'users';

}

 

/**

* @return array validation rules for model attributes.

*/

public function rules()

{

// NOTE: you should only define rules for those attributes that

// will receive user inputs.

return array(

array('email, name, role', 'required'),

array('password', 'required', 'on' => 'insert'),

array('password', 'length', 'min' => 6, 'max' => 32, 'on' => 'insert'),

array('newPassword', 'length', 'max' => 32),

array('email', 'length', 'max'=>64),

array('email', 'unique', 'caseSensitive' => false),

array('name, newPassword, role', 'length', 'max'=>32),





:


: 2015-11-05; !; : 1201 |


:

:

, , 1:10
==> ...

1748 - | 1692 -


© 2015-2024 lektsii.org - -

: 0.971 .