Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Изменение статусов
- Loading branch information
Showing
5 changed files
with
87 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
class TodoStatusHelper | ||
{ | ||
const STATUS_CANCELLED = 0; | ||
const STATUS_DEFAULT = 1; | ||
const STATUS_URGENT = 2; | ||
const STATUS_DONE = 3; | ||
|
||
/** | ||
* Return a list of statuses | ||
* | ||
* @return array | ||
*/ | ||
public static function getList() | ||
{ | ||
return [ | ||
self::STATUS_CANCELLED => 'Отменена', | ||
self::STATUS_DEFAULT => 'Обычная', | ||
self::STATUS_URGENT => 'Срочная', | ||
self::STATUS_DONE => 'Выполнена', | ||
]; | ||
} | ||
|
||
/** | ||
* Get css class names list | ||
* | ||
* @return array | ||
*/ | ||
public static function getStylesList() | ||
{ | ||
return [ | ||
self::STATUS_CANCELLED => ['class' => 'label-danger'], | ||
self::STATUS_DEFAULT => ['class' => 'label-default'], | ||
self::STATUS_URGENT => ['class' => 'label-primary'], | ||
self::STATUS_DONE => ['class' => 'label-success'], | ||
]; | ||
} | ||
|
||
/** | ||
* Get status label by id | ||
* | ||
* @param int $id | ||
* @return string | ||
*/ | ||
public static function getLabel($id) | ||
{ | ||
$list = self::getList(); | ||
|
||
return $list[$id]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters