Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 12... Línea 12...
12
// GNU General Public License for more details.
12
// GNU General Public License for more details.
13
//
13
//
14
// You should have received a copy of the GNU General Public License
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
Línea 16... Línea -...
16
 
-
 
17
/**
-
 
18
 * Mustache helper that will convert a timestamp to a date string.
-
 
19
 *
-
 
20
 * @package    core
-
 
21
 * @category   output
-
 
22
 * @copyright  2017 Ryan Wyllie <ryan@moodle.com>
-
 
23
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-
 
24
 */
-
 
25
 
16
 
Línea 26... Línea -...
26
namespace core\output;
-
 
27
 
-
 
28
defined('MOODLE_INTERNAL') || die();
17
namespace core\output;
Línea 29... Línea 18...
29
 
18
 
30
use Mustache_LambdaHelper;
19
use Mustache_LambdaHelper;
31
 
20
 
32
/**
21
/**
33
 * Mustache helper that will convert a timestamp to a date string.
22
 * Mustache helper that will convert a timestamp to a date string.
-
 
23
 *
34
 *
24
 * @copyright  2017 Ryan Wyllie <ryan@moodle.com>
35
 * @copyright  2017 Ryan Wyllie <ryan@moodle.com>
25
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
36
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-
 
37
 */
26
 * @package core
38
class mustache_user_date_helper {
27
 */
39
 
28
class mustache_user_date_helper {
40
    /**
29
    /**
41
     * Read a timestamp and format from the string.
30
     * Read a timestamp and format from the string.
Línea 50... Línea 39...
50
     * @param Mustache_LambdaHelper $helper Used to render nested mustache variables.
39
     * @param Mustache_LambdaHelper $helper Used to render nested mustache variables.
51
     * @return string
40
     * @return string
52
     */
41
     */
53
    public function transform($args, Mustache_LambdaHelper $helper) {
42
    public function transform($args, Mustache_LambdaHelper $helper) {
54
        // Split the text into an array of variables.
43
        // Split the text into an array of variables.
55
        list($timestamp, $format) = explode(',', $args, 2);
44
        [$timestamp, $format] = explode(',', $args, 2);
56
        $timestamp = trim($timestamp);
45
        $timestamp = trim($timestamp);
57
        $format = trim($format);
46
        $format = trim($format);
Línea 58... Línea 47...
58
 
47
 
59
        $timestamp = $helper->render($timestamp);
48
        $timestamp = $helper->render($timestamp);