Skip to content

Commit

Permalink
Merge pull request #1402 from voltan/develop
Browse files Browse the repository at this point in the history
Update user / wight modules and video-js
  • Loading branch information
taiwen committed Apr 1, 2016
2 parents daf65f1 + 27932cd commit e2f0e4a
Show file tree
Hide file tree
Showing 75 changed files with 2,426 additions and 1,512 deletions.
48 changes: 41 additions & 7 deletions lib/Pi/View/Helper/Videojs.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*
* Usage inside a phtml template
*
* $this->videojs($source);
* $this->videojs($source, $poster);
* $this->videojs($source, $poster, $width, $height);
*
Expand All @@ -39,22 +40,55 @@ class Videojs extends AbstractHtmlElement
*
* @return string
*/
public function __invoke($source, $poster, $width = 640, $height = 264)
public function __invoke($source, $poster = '', $width = '', $height = '')
{
// Set template
// Get media extension
$extension = pathinfo($source, PATHINFO_EXTENSION);

// Set template
switch ($extension) {

case 'mp3':
// Set player poster
if (empty($poster)) {
$image = Pi::path('upload/video-js/audio.jpg');
if (Pi::service('file')->exists($image)) {
$poster = Pi::url('upload/video-js/audio.jpg');
} else {
$poster = Pi::url('static/vendor/video-js/image/audio.jpg');
}
}

// Set player width and height
$width = !empty($width) ? $width : 1280;
$height = !empty($height) ? $height : 180;

// Set html template
$template = <<<'EOT'
<audio id="%s" class="video-js vjs-default-skin" width="%d" height="%d" poster="%s" data-setup='{ "controls": true, "autoplay": false, "preload": "auto" }'>
<audio id="%s" class="video-js vjs-default-skin" width="%d" height="%d" controls preload="none" poster="%s" data-setup='{"aspectRatio":"%s:%s"}'>
<source src="%s" type='audio/mp3' />
</audio>
EOT;
break;

case 'mp4':
// Set player poster
if (empty($poster)) {
$image = Pi::path('upload/video-js/video.jpg');
if (Pi::service('file')->exists($image)) {
$poster = Pi::url('upload/video-js/video.jpg');
} else {
$poster = Pi::url('static/vendor/video-js/image/video.jpg');
}
}

// Set player width and height
$width = !empty($width) ? $width : 1280;
$height = !empty($height) ? $height : 720;

// Set html template
$template = <<<'EOT'
<video id="%s" class="video-js vjs-default-skin" width="%d" height="%d" poster="%s" data-setup='{ "controls": true, "autoplay": false, "preload": "auto" }'>
<video id="%s" class="video-js vjs-default-skin" width="%d" height="%d" controls preload="none" poster="%s" data-setup='{"aspectRatio":"%s:%s"}'>
<source src="%s" type='video/mp4' />
</video>
EOT;
Expand All @@ -65,10 +99,10 @@ public function __invoke($source, $poster, $width = 640, $height = 264)
}

// Load js file
$js = 'vendor/video-js/video.js';
$js = 'vendor/video-js/video.min.js';
$js = Pi::service('asset')->getStaticUrl($js);
$this->view->js($js);

// Load css file
$css = 'vendor/video-js/video-js.min.css';
$css = Pi::service('asset')->getStaticUrl($css);
Expand All @@ -78,7 +112,7 @@ public function __invoke($source, $poster, $width = 640, $height = 264)
$id = uniqid("video-js-");

// Set final content
$content = sprintf($template, $id, $width, $height, $poster, $source);
$content = sprintf($template, $id, $width, $height, $poster, $width, $height, $source);

return $content;
}
Expand Down
43 changes: 34 additions & 9 deletions usr/custom/module/user/config/form.register.php.dist
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
<?php
/**
* Pi Engine (http://pialog.org)
*
* @link http://code.pialog.org for the Pi Engine source repository
* @copyright Copyright (c) Pi Engine http://pialog.org
* @license http://pialog.org/license.txt BSD 3-Clause License
*/
* Pi Engine (http://pialog.org)
*
* @link http://code.pialog.org for the Pi Engine source repository
* @copyright Copyright (c) Pi Engine http://pialog.org
* @license http://pialog.org/license.txt BSD 3-Clause License
*/

/**
* User register form config
*/
* User register form config
*/

$captchaEnable = Pi::user()->config('register_captcha');
$termEnable = Pi::user()->config('register_term');
$termUrl = Pi::user()->config('register_term_url');

if ($termEnable && !empty($termUrl)) {
$termEnable = true;
$term = sprintf('<a href="%s" target="_blank">%s</a>', $termUrl, __('Terms & Conditions'));
$term = sprintf(__('Accept %s'), $term);
} else {
$termEnable = false;
$term = '';
}

return array(
// Use user module field
Expand Down Expand Up @@ -63,11 +74,25 @@ return array(
'captcha_position' => 'append',
),
'attributes' => array(
'required' => true,
'required' => true,
),
),
),

'term' => !$termEnable ? false : array(
'element' => array(
'name' => 'term',
'type' => 'checkbox',
'options' => array(
'label' => '',
),
'attributes' => array(
'description' => $term,
'required' => true,
)
),
),

'register_source' => array(
'element' => array(
'attributes' => array(
Expand Down
24 changes: 0 additions & 24 deletions usr/custom/module/user/config/user.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -51,36 +51,12 @@ $customConfig = array(
'mobile' => array(
'name' => 'mobile',
'title' => _a('Mobile phone'),
// Edit element specs
'edit' => array(
'validators' => array(
array(
'name' => 'Zend\I18n\Validator\PhoneNumber',
'options' => array(
'country' => 'cn',
'allowed_types' => array('mobile'),
),
),
),
),
),

// Profile: phone
'phone' => array(
'name' => 'phone',
'title' => _a('Telephone'),
// Edit element specs
'edit' => array(
'validators' => array(
array(
'name' => 'Zend\I18n\Validator\PhoneNumber',
'options' => array(
'country' => 'cn',
'allowed_types' => array('general'),
),
),
),
),
),


Expand Down
24 changes: 0 additions & 24 deletions usr/custom/module/user/config/user.php.order
Original file line number Diff line number Diff line change
Expand Up @@ -50,36 +50,12 @@ $customConfig = array(
'mobile' => array(
'name' => 'mobile',
'title' => _a('Mobile phone'),
// Edit element specs
'edit' => array(
'validators' => array(
array(
'name' => 'Zend\I18n\Validator\PhoneNumber',
'options' => array(
'country' => 'ir',
'allowed_types' => array('mobile'),
),
),
),
),
),

// Profile: phone number
'phone' => array(
'name' => 'phone',
'title' => _a('Telephone'),
// Edit element specs
'edit' => array(
'validators' => array(
array(
'name' => 'Zend\I18n\Validator\PhoneNumber',
'options' => array(
'country' => 'ir',
'allowed_types' => array('general'),
),
),
),
),
),

// Profile: address1
Expand Down
Binary file added usr/custom/module/user/locale/fa/admin.mo.dist
Binary file not shown.
147 changes: 147 additions & 0 deletions usr/custom/module/user/locale/fa/admin.po.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
msgid ""
msgstr ""
"Project-Id-Version: Pi-user\n"
"POT-Creation-Date: 2016-03-01 11:39+0330\n"
"PO-Revision-Date: 2016-03-01 11:43+0330\n"
"Last-Translator: Taiwen Jiang <[email protected]>\n"
"Language-Team: \n"
"Language: fa\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.6\n"
"X-Poedit-KeywordsList: _a;_t\n"
"X-Poedit-Basepath: ../..\n"
"X-Poedit-SearchPath-0: .\n"

#: config/form.register.php:39
msgid "Confirm credential"
msgstr "تایید واژه رمز"

#: config/form.register.php:72
msgid "Please type the word."
msgstr "لطفا این عبارت را وارد کنید "

#: config/user.php:25
msgid "Register source"
msgstr "منبع ثبت نام"

#: config/user.php:34 config/user1.php:40
msgid "First Name"
msgstr "نام"

#: config/user.php:40 config/user1.php:46
msgid "Last Name"
msgstr "نام خانوادگی"

#: config/user.php:46
msgid "Language"
msgstr "زبان"

#: config/user.php:53 config/user1.php:52
msgid "Mobile phone"
msgstr "تلفن همراه"

#: config/user.php:59 config/user1.php:58
msgid "Telephone"
msgstr "تلفن"

#: config/user.php:68
msgid "Education"
msgstr "آموزش"

#: config/user.php:76
msgid "School name"
msgstr "نام دانشگاه"

#: config/user.php:82
msgid "Department"
msgstr "بخش"

#: config/user.php:88
msgid "Major"
msgstr "رشته"

#: config/user.php:94
msgid "Degree"
msgstr "مدرک"

#: config/user.php:100 config/user.php:169
msgid "Start time"
msgstr "تاریخ شروع"

#: config/user.php:106 config/user.php:175
msgid "End time"
msgstr "تاریخ پایان"

#: config/user.php:109 config/user.php:159
msgid "Description"
msgstr "توضیحات"

#: config/user.php:124
msgid "Work"
msgstr "شغل"

#: config/user.php:132
msgid "Company name"
msgstr "نام شرکت"

#: config/user.php:138
msgid "Work Department"
msgstr "بخش"

#: config/user.php:144
msgid "Industry"
msgstr "صنعت"

#: config/user.php:150
msgid "Sector"
msgstr "زیر بخش"

#: config/user.php:153
msgid "Job title"
msgstr "عنوان شغلی"

#: config/user1.php:24
msgid "Credit"
msgstr "اعتبار"

#: config/user1.php:34
msgid "Identification number"
msgstr "کد مل"

#: config/user1.php:64
msgid "Address 1"
msgstr "آدرس"

#: config/user1.php:70
msgid "Address 2"
msgstr "آدرس دوم"

#: config/user1.php:76
msgid "Country"
msgstr "کشور"

#: config/user1.php:82
msgid "State"
msgstr "استان"

#: config/user1.php:88
msgid "City"
msgstr "شهر"

#: config/user1.php:94
msgid "Zip code"
msgstr "کد پستی"

#: config/user1.php:100
msgid "Company"
msgstr "شرکت"

#: config/user1.php:106
msgid "Company ID"
msgstr "شماره ثبت شرکت"

#: config/user1.php:112
msgid "Company VAT"
msgstr "کد اقتصادی شرکت"
Binary file added usr/custom/module/user/locale/fa/default.mo.dist
Binary file not shown.
Loading

0 comments on commit e2f0e4a

Please sign in to comment.