예제 #1
0
<?php

/**
 *
 * @package    mahara
 * @subpackage artefact-flexifact
 * @author     EdICT Training Ltd
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
 * @copyright  For copyright information on Mahara, please see the README file distributed with this software.
 *
 */
define('INTERNAL', 1);
define('JSON', 1);
require dirname(dirname(dirname(__FILE__))) . '/init.php';
safe_require('artefact', 'flexifact');
$limit = param_integer('limit', 10);
$offset = param_integer('offset', 0);
$flexifact = ArtefactTypeFlexifact::get_flexifact($offset, $limit);
ArtefactTypeTarget::build_flexifact_list_html($flexifact);
json_reply(FALSE, (object) array('message' => FALSE, 'data' => $flexifact));
예제 #2
0
파일: lib.php 프로젝트: edictdev/flexifact
 /**
  * @param Pieform $form
  * @param $values
  */
 public static function submit(Pieform $form, $values)
 {
     global $USER, $SESSION;
     if (isset($values['flexifact'])) {
         $id = (int) $values['flexifact'];
         $artefact = new ArtefactTypeFlexifact($id);
     } else {
         $artefact = new ArtefactTypeFlexifact();
         $artefact->set('owner', $USER->get('id'));
     }
     $artefact->set('title', $values['title']);
     $artefact->commit();
     $SESSION->add_ok_msg(get_string('savedsuccessfully', 'artefact.flexifact'));
     $data = $form->get_elements('data');
     foreach ($data as $elements) {
         foreach ($elements as $key => $element) {
             if ($key == 'goto') {
                 redirect($element);
             }
         }
     }
 }
예제 #3
0
파일: edit.php 프로젝트: edictdev/flexifact
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
 * @copyright  For copyright information on Mahara, please see the README file distributed with this software.
 *
 */
define('INTERNAL', TRUE);
define('MENUITEM', 'flexifact');
require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php';
require_once 'pieforms/pieform.php';
require_once 'pieforms/pieform/elements/calendar.php';
require_once get_config('docroot') . 'artefact/lib.php';
safe_require('artefact', 'flexifact');
if (!PluginArtefactFlexifact::is_active()) {
    throw new AccessDeniedException(get_string('plugindisableduser', 'mahara', get_string('flexifact', 'artefact.flexifact')));
}
define('TITLE', get_string('edit', 'artefact.flexifact'));
$id = param_integer('id', 0);
if ($id != 0) {
    $artefact = new ArtefactTypeFlexifact($id);
    $canedit = ArtefactTypeFlexifact::can_edit($USER, $artefact);
    //todo Testing this is always true function not real
    if (!$canedit) {
        throw new AccessDeniedException(get_string('accessdenied', 'error'));
    }
    $form = ArtefactTypeFlexifact::get_form($artefact);
} else {
    $form = ArtefactTypeFlexifact::get_form();
}
$smarty = smarty();
$smarty->assign('form', $form);
$smarty->assign('PAGEHEADING', hsc(get_string("create", "artefact.flexifact")));
$smarty->display('artefact:flexifact:edit.tpl');