Example #1
0
 public function actionList()
 {
     $modules = $this->getInstalledModules();
     $setting = new ModuleForm();
     $setting->getSetting();
     $this->layout = "//layouts/admin/nonav_column1";
     $this->render('list', array('modules' => $modules, 'setting' => $setting));
 }
 protected static function translatedAttributeLabels($language)
 {
     return array_merge(parent::translatedAttributeLabels($language), array('a' => 'A', 'b' => 'A', 'c' => 'A'));
 }
Example #3
0
 protected function untranslatedAttributeLabels()
 {
     return array_merge(parent::untranslatedAttributeLabels(), array('a' => 'A', 'b' => 'A', 'c' => 'A'));
 }
 public function attributeLabels()
 {
     return array_merge(parent::attributeLabels(), array('globalSearchAttributeNames' => Zurmo::t('ZurmoModule', 'Global and Basic Search Fields')));
 }
Example #5
0
 *
 * @package core
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once dirname(__FILE__) . '/../../config.php';
require_once $CFG->libdir . '/adminlib.php';
require_once $CFG->dirroot . '/blocks/webgd_community/form/ModuleForm.php';
require_once $CFG->dirroot . '/blocks/webgd_community/commons/TableResouces.php';
global $USER;
require_login(1);
$PAGE->set_url('/course/index.php');
$PAGE->set_context(context_system::instance());
$PAGE->set_pagelayout('standard');
echo $OUTPUT->header('');
echo $OUTPUT->heading(get_string('adicionarComunidade', 'block_webgd_community'));
$mform = new ModuleForm();
if ($data = $mform->get_data()) {
    $realfilename = $mform->get_new_filename('file');
    // this gets the name of the file
    $random = rand();
    // generate some random number
    $new_file = $random . '_' . $realfilename;
    //add some random string to the file
    $dst = $CFG->dataroot . "/blocks/webgd_community/{$new_file}";
    // directory name+ new filename
    $communuty = new stdClass();
    $communuty->name = $data->nome;
    $communuty->close_community = $data->close_community;
    $communuty->description = $data->conteudo['text'];
    $communuty->userid = $USER->id;
    $communuty->timecreated = time();
Example #6
0
 */
require_once dirname(__FILE__) . '/../../config.php';
require_once $CFG->libdir . '/adminlib.php';
require_once $CFG->dirroot . '/blocks/webgd_community/form/ModuleForm.php';
require_once $CFG->dirroot . '/blocks/webgd_community/commons/TableResouces.php';
require_once $CFG->dirroot . '/blocks/webgd_community/lib/class/CssResources.php';
require_once $CFG->dirroot . '/blocks/webgd_community/lib/class/dao/WebgdCommunityDao.php';
global $USER;
require_login(1);
$PAGE->set_url('/course/index.php');
$PAGE->set_context(context_system::instance());
$PAGE->set_pagelayout('standard');
$PAGE->requires->css(CssResources::HOME_COMMUNITY);
$idCommunity = optional_param('community', 0, PARAM_INTEGER);
echo $OUTPUT->header('');
$mform = new ModuleForm(null, array('community' => $idCommunity));
if ($data = $mform->get_data()) {
    if ($data->id) {
        echo $OUTPUT->heading("Editar Comunidade");
    } else {
        echo $OUTPUT->heading(get_string('adicionarComunidade', 'block_webgd_community'));
    }
    if ($data->id) {
        $msg = get_string('msgErro', 'block_webgd_community');
        $webgdDao = new WebgdCommunityDao();
        if ($communityDao = $webgdDao->findCommunityById($data->id)) {
            $communityDao->name = $data->nome;
            $communityDao->description = $data->conteudo;
            $communityDao->close_community = $data->close_community;
            $realfilename = $mform->get_new_filename('video');
            // this gets the name of the file
 public function executeUpdate($request)
 {
     $object = $this->getRequestParameter('object');
     $user = User::getByApiKey($request->getParameter('login_id'), $request->getParameter('api_key'));
     if (!$user) {
         $output = '<rsp stat="fail"><err code="2" msg="login_id and api_key do not match" /></rsp>';
     } elseif ($object == 'application') {
         $form = new ApplicationForm();
         $form->bind(array('id' => $request->getParameter('id'), 'name' => $request->getParameter('name'), 'description' => $request->getParameter('description'), 'source_url' => $request->getParameter('source_url')));
         if ($form->isValid()) {
             $application = Application::update($form->getValues(), $user);
             if ($application) {
                 $output = '<rsp stat="ok">' . $application->getXML() . '</rsp>';
             } else {
                 $output = '<rsp stat="fail"><err code="4" msg="Unable to update application." /></rsp>';
             }
         } else {
             $output = '<rsp stat="fail"><err code="4" msg="' . $form->getErrorSchema() . '" /></rsp>';
         }
     } elseif ($object == 'comment') {
         $form = new CommentForm();
         $application_id = $module_id = $theme_id = null;
         if ($request->getParameter('application_id')) {
             $application_id = $request->getParameter('application_id');
         }
         if ($request->getParameter('module_id')) {
             $module_id = $request->getParameter('module_id');
         }
         if ($request->getParameter('theme_id')) {
             $theme_id = $request->getParameter('theme_id');
         }
         $form->bind(array('comment' => $request->getParameter('comment'), 'application_id' => $application_id, 'module_id' => $module_id, 'theme_id' => $theme_id));
         if ($form->isValid()) {
             $comment = Comment::update($form->getValues(), $user);
             $output = '<rsp stat="ok">' . $comment->getXML() . '</rsp>';
         } else {
             $output = '<rsp stat="fail"><err code="3" msg="' . $form->getErrorSchema() . '" /></rsp>';
         }
     } elseif ($object == 'module') {
         $form = new ModuleForm();
         $form->bind(array('id' => $request->getParameter('id'), 'name' => $request->getParameter('name'), 'description' => $request->getParameter('description'), 'source_url' => $request->getParameter('source_url'), 'application_id' => $request->getParameter('application_id')));
         if ($form->isValid()) {
             $module = Madule::update($form->getValues(), $user);
             if ($module) {
                 $output = '<rsp stat="ok">' . $module->getXML() . '</rsp>';
             } else {
                 $output = '<rsp stat="fail"><err code="4" msg="Unable to update module." /></rsp>';
             }
         } else {
             $output = '<rsp stat="fail"><err code="4" msg="' . $form->getErrorSchema() . '" /></rsp>';
         }
     } elseif ($object == 'theme') {
         $form = new ThemeForm();
         $form->bind(array('id' => $request->getParameter('id'), 'name' => $request->getParameter('name'), 'description' => $request->getParameter('description')), $request->getFiles());
         if ($form->isValid()) {
             $theme = Theme::update($form->getValues(), $user);
             if ($theme) {
                 $output = '<rsp stat="ok">' . $theme->getXML() . '</rsp>';
             } else {
                 $output = '<rsp stat="fail"><err code="5" msg="Unable to update theme." /></rsp>';
             }
         } else {
             $output = '<rsp stat="fail"><err code="5" msg="' . $form->getErrorSchema() . '" /></rsp>';
         }
     } elseif ($object == 'theme_group') {
         $output = '<rsp stat="fail"><err code="6" msg="This object is not supported for update" /></rsp>';
     } elseif ($object == 'user') {
         $form = new UserForm();
         $form->bind(array('id' => $request->getParameter('id'), 'name' => $request->getParameter('name'), 'password' => $request->getParameter('password'), 'password2' => $request->getParameter('password'), 'email' => $request->getParameter('email'), 'role' => null));
         if ($form->isValid()) {
             $update_user = User::update($form->getValues(), $user);
             if ($update_user) {
                 $output = '<rsp stat="ok">' . $update_user->getXML() . '</rsp>';
             } else {
                 $output = '<rsp stat="fail"><err code="7" msg="Unable to update user." /></rsp>';
             }
         } else {
             $output = '<rsp stat="fail"><err code="7" msg="' . $form->getErrorSchema() . '" /></rsp>';
         }
     }
     $this->output = $output;
     $this->setTemplate('index');
 }