예제 #1
0
 public function index()
 {
     $request = $this->getRequest();
     $mailchimp = $this->get('core.mailchimp.manager');
     if ($request->isMethod('post')) {
         $lists = $request->request->get('lists');
         $groups = $request->request->get('groups');
         if (!empty($lists) && !empty($groups)) {
             try {
                 $result = $mailchimp->exportEmails($groups, $lists);
                 foreach ($result as $message) {
                     $this->addFlash($message, 'success');
                 }
             } catch (Exception $e) {
                 $this->addFlash($e->getMessage());
             }
         } else {
             $this->addFlash(lang('not_selected_error'));
         }
     }
     $lists = $mailchimp->getLists();
     $groups = Group::findAll();
     $this->template->set('groups', $groups);
     $this->template->set('lists', $lists);
     $this->template->render();
 }
예제 #2
0
 public function Calculate()
 {
     /// Calculate number of users, etc...
     $this->stats['Users'] = sizeof(Account::findAll());
     $this->stats['Groups'] = sizeof(Group::findAll());
     $this->stats['Items'] = sizeof(Menu::list_files(Settings::$photos_dir, true));
     $this->stats['Generated items'] = sizeof(Menu::list_files(Settings::$thumbs_dir, true));
     $this->stats['Albums'] = sizeof(Menu::list_dirs(Settings::$photos_dir, true));
     $this->accounts = array_reverse(Account::findAll());
     $commentsfile = Settings::$conf_dir . "/comments.xml";
     if (is_file($commentsfile)) {
         $xml = simplexml_load_file($commentsfile);
         $this->comments = $xml->children();
     }
 }
예제 #3
0
 based checks for this group. <a href="<?php 
    echo Check::makeURL('add', $check_type);
    ?>
&filter_group_id=<?php 
    echo $filter_group_id;
    ?>
">Add one now</a>
		<p class="pull-right">
			Filter group :
			<select id="list_of_filters">
				<option value="<?php 
    echo Check::makeURL('list', $check_type, -1);
    ?>
">All checks</option>
				<?php 
    foreach (Group::findAll() as $group) {
        ?>
						<option value="<?php 
        echo Check::makeURL('list', $check_type, $group->getGroupId());
        ?>
" <?php 
        echo $filter_group_id == $group->getGroupId() ? 'selected="selected"' : '';
        ?>
><?php 
        echo $group->getName();
        ?>
</option>
				<?php 
    }
    ?>
			</select>
예제 #4
0
 public function toHTML()
 {
     $groupaccounts = array();
     echo "<div class='header'><h1>Groups</h1></div>";
     echo "<form class='pure-form pure-form-aligned' method='post' action='?t=Adm&a=GC'>\r\n\t\t\t<h2>" . Settings::_("jsaccounts", "addgroup") . "</h2>\r\n\t\t\t<div class='pure-control-group'>\r\n\t\t\t<label>Group name : </label><input type='text' name='group' placeholder='" . Settings::_("jsaccounts", "groupname") . "' />\r\n\t\t\t</div>\r\n\t\t\t<div class='pure-controls'>\r\n\t\t\t<input type='submit' class='pure-button button-success' value='" . Settings::_("jsaccounts", "addgroup") . "' />\r\n\t\t\t</div>\r\n\t\t\t</form>";
     echo "<form class='pure-form pure-form-aligned' method='post' action='?t=Adm&a=GEd'>";
     echo "<h2>" . Settings::_("jsaccounts", "groups") . "</h2>";
     foreach (Group::findAll() as $g) {
         $gn = $g['name'];
         $group = htmlentities($gn, ENT_QUOTES, 'UTF-8');
         echo "<div class='pure-g' style='border-bottom: 1px solid #ccc; padding-bottom: 15px; margin: 20px;'>";
         echo "<div class='pure-u-1-1 pure-u-md-1-3'>";
         echo "<h3><a href=\"?t=Adm&a=GDe&g=" . urlencode($gn) . "\" class='pure-button button-error button-small'><i class='fa fa-trash-o '></i></a> " . htmlentities($gn, ENT_QUOTES, 'UTF-8') . "</h3>";
         echo "</div>";
         echo "<div class='pure-u-1-1 pure-u-md-2-3'>";
         foreach (Account::findAll() as $acc) {
             $login = htmlentities($acc["login"], ENT_QUOTES, 'UTF-8');
             $checked = in_array($gn, $acc["groups"]) ? "checked" : "";
             echo "<div class='pure-controls'>";
             echo "<label><input type='checkbox' name=\"{$group}" . "[]\" value=\"{$login}\" {$checked} > {$login}</label>";
             echo "</div>";
         }
         echo "</div>";
         echo "</div>";
     }
     echo "<div class='pure-controls'><input type='submit' class='pure-button pure-button-primary'></div>";
     echo "</form>";
 }
예제 #5
0
파일: Judge.php 프로젝트: nemtos/PhotoShow
 /**
  * Display the rights on website, and let
  * the admin edit them.
  * 
  * @author Thibaud Rohmer
  */
 public function toHTML()
 {
     echo "<div class='adminrights'>\n";
     echo "<h3>" . htmlentities($this->filename, ENT_QUOTES, 'UTF-8') . "</h3>\n";
     if ($this->public) {
         echo "<form action='?t=Pri&f={$this->webpath}' method='post'>\n";
         echo Settings::_("judge", "public");
         echo "<input type='submit' class='button blue' value='" . Settings::_("judge", "gopriv") . "' />";
         echo "</form>";
         echo "</div>";
         return;
     } else {
         echo "<form action='?t=Pub&f={$this->webpath}' method='post'>\n";
         echo Settings::_("judge", "priv");
         echo "<input type='submit' class='button blue' value='" . Settings::_("judge", "gopub") . "' />";
         echo "</form>";
     }
     echo "<form action='?t=Rig&f={$this->webpath}' method='post'>\n";
     echo "<h3>" . Settings::_("judge", "accounts") . "</h3>";
     foreach (Account::findAll() as $account) {
         if (in_array($account['login'], $this->users)) {
             $checked = "checked";
         } else {
             $checked = "";
         }
         echo "<label><input type='checkbox' value='" . $account['login'] . "' name='users[]' {$checked} >" . htmlentities($account['login'], ENT_QUOTES, 'UTF-8') . "</label>";
     }
     echo "<h3>" . Settings::_("judge", "groups") . "</h3>";
     foreach (Group::findAll() as $group) {
         if ($group['name'] == "root") {
             continue;
         }
         if (in_array($group['name'], $this->groups)) {
             $checked = "checked";
         } else {
             $checked = "";
         }
         echo "<label><input type='checkbox' value='" . $group['name'] . "' name='groups[]' {$checked} > " . htmlentities($group['name'], ENT_QUOTES, 'UTF-8') . " </label>";
     }
     echo "</br><input type='submit' class='button blue' value='" . Settings::_("judge", "set") . "'>\n";
     echo "</form>\n";
     echo "</div>\n";
 }
예제 #6
0
 /**
  * Display the rights on website, and let
  * the admin edit them.
  * 
  * @author Thibaud Rohmer
  */
 public function toHTML()
 {
     echo "<div class='adminrights'>\n";
     echo "<h3>Infos</h3>";
     echo $this->infos;
     echo "<h3>Access</h3>";
     if ($this->public) {
         echo "<div class='pure-g'><div class='pure-u-1-3'>";
         echo "<a href='?t=Pri{$this->webpath}'class='button-round button-success'><i class='fa fa-unlock'></i></a></div>";
         echo "<div class='pure-u-2-3'>" . Settings::_("judge", "public") . "</div></div>";
     } else {
         echo "<div class='pure-g'><div class='pure-u-1-3'>";
         echo "<a href='?t=Pub{$this->webpath}'class='button-round button-error'><i class='fa fa-lock'></i></a></div>";
         echo "<div class='pure-u-2-3'>" . Settings::_("judge", "priv") . "</div></div>";
     }
     echo "<form action='?t=Rig{$this->webpath}' method='post' class='pure-form pure-form-aligned'>";
     if (!$this->public) {
         echo "<h3>" . Settings::_("judge", "accounts") . "</h3>";
         echo "<ul>";
         foreach (Account::findAll() as $account) {
             if (in_array($account['login'], $this->users)) {
                 $checked = "checked";
             } else {
                 $checked = "";
             }
             echo "<label class='pure-checkbox'><input type='checkbox'  value='" . $account['login'] . "' name='users[]' {$checked} > " . htmlentities($account['login'], ENT_QUOTES, 'UTF-8') . "</label>";
         }
         echo "</ul>";
         echo "<h3>" . Settings::_("judge", "groups") . "</h3>";
         echo "<ul>";
         foreach (Group::findAll() as $group) {
             if ($group['name'] == "root") {
                 continue;
             }
             if (in_array($group['name'], $this->groups)) {
                 $checked = "checked";
             } else {
                 $checked = "";
             }
             echo "<label class='pure-checkbox'><input type='checkbox'   value='" . $group['name'] . "' name='groups[]' {$checked} > " . htmlentities($group['name'], ENT_QUOTES, 'UTF-8') . " </label>";
         }
         echo "<input type='submit' class='pure-button pure-button-primary button-small' value='" . Settings::_("judge", "set") . "'>\n";
         echo "</ul>";
         echo "<h3>Guest Tokens</h3>";
         if (!$this->multi) {
             // Token creation
             $tokens = GuestToken::find_for_path($this->file);
             if ($tokens && !empty($tokens)) {
                 echo "<ul>";
                 $i = 0;
                 foreach ($tokens as $token) {
                     $i++;
                     echo "<a class='pure-button button-small button-warning' href='" . GuestToken::get_url($token['key']) . "' >Guest Token {$i}</a><br />\n";
                 }
                 echo "</ul>";
             }
             echo "<ul><a href='?t=CTk{$this->webpath}' class='pure-button button-secondary button-small'>" . Settings::_("token", "createtoken") . "</a></ul>";
         }
     }
     echo "</form>\n";
     echo "</div>\n";
 }
예제 #7
0
파일: Group.php 프로젝트: vangogogo/justsns
 public function getGroups($params = array(), $limit = 0)
 {
     if (!isset($params['status'])) {
         $params['status'] = 1;
     }
     if (!isset($params['is_delete'])) {
         $params['is_del'] = 0;
     }
     $model = new Group();
     $criteria = new CDbCriteria();
     $criteria->condition .= "1";
     $criteria->order = !empty($params['order']) ? $params['order'] : 't.ctime';
     if (!empty($limit)) {
         $criteria->limit = $limit;
     }
     if (!empty($params)) {
         $array = array('id', 'uid', 'cid0', 'cid1', 'type', 'status', 'is_del');
         foreach ($params as $key => $value) {
             if (in_array($key, $array)) {
                 $criteria->condition .= " and {$key}=:{$key}";
                 $criteria->params[':' . $key] = $value;
             }
         }
     }
     $pageSize = $params['pageSize'];
     if (!empty($pageSize)) {
         $page = $params['page'];
         $_GET['page'] = $page;
         $total = $model->count($criteria);
         $pages = new CPagination($total);
         $pages->pageSize = $pageSize ? $pageSize : self::PAGE_SIZE;
         $pages->applyLimit($criteria);
     }
     $models = $model->findAll($criteria);
     $data = array('group_list' => $models, 'group_pages' => $pages);
     return $data;
 }
예제 #8
0
 public function __construct()
 {
     $this->accounts = Account::findAll();
     $this->groups = Group::findAll();
 }
예제 #9
0
 /**
  * Display upload page on website
  * 
  * @author Thibaud Rohmer
  */
 public function toHTML()
 {
     echo "<h1>Upload</h1>";
     echo "<form action='?t=Adm&a=Upl' method='post' enctype='multipart/form-data'>";
     echo "<fieldset><span>Images</span><div><input  name='images[]' type='file' multiple /></div></fieldset>";
     echo "<fieldset><span>Location</span><div><select name='path'>";
     echo "<option value='.'>.</option>";
     foreach ($this->dirs as $dir) {
         if ($dir == $this->selected_dir) {
             $selected = "selected";
         } else {
             $selected = "";
         }
         echo "<option value='" . htmlentities($dir, ENT_QUOTES, 'UTF-8') . "' {$selected}>" . htmlentities($dir, ENT_QUOTES, 'UTF-8') . "</option>\n";
     }
     echo "</select></div></fieldset>";
     echo "<fieldset><span>New Dir</span><div><input name='newdir' type='text' /></div></fieldset>";
     echo "<fieldset><span>Rights</span><div><label><input type='checkbox' name='inherit' checked /> Inherit</label></div></fieldset>";
     echo "<fieldset><span>Public</span><div><label><input type='checkbox' name='public' checked /> Public</label></div></fieldset>";
     echo "<fieldset><span>Groups</span><div>";
     foreach (Group::findAll() as $group) {
         echo "<label><input type='checkbox' name='groups[]' value='" . htmlentities($group['name'], ENT_QUOTES, 'UTF-8') . "' checked /> " . htmlentities($group['name'], ENT_QUOTES, 'UTF-8') . " </label>";
     }
     echo "</div></fieldset>";
     echo "<fieldset><span>Users</span><div>";
     foreach (Account::findAll() as $account) {
         echo "<label><input type='checkbox' name='users[]' value='" . htmlentities($account['login'], ENT_QUOTES, 'UTF-8') . "' checked /> " . htmlentities($account['login'], ENT_QUOTES, 'UTF-8') . " </label>";
     }
     echo "</div></fieldset>";
     echo "<fieldset><input type='submit' class='button blue' /></fieldset>";
     echo "</form>";
 }
예제 #10
0
파일: groups.php 프로젝트: nagyist/Tattle
            }
        } catch (fNotFoundException $e) {
            fMessaging::create('error', "/" . Group::makeUrl('list'), 'The Group requested, ' . fHTML::encode($group_id) . ', could not be found');
            fURL::redirect(Group::makeUrl('list'));
        } catch (fExpectedException $e) {
            fMessaging::create('error', fURL::get(), $e->getMessage());
        }
        include VIEW_PATH . '/add_edit_group.php';
    }
    // --------------------------------- //
} elseif ('add' == $action) {
    $group = new Group();
    if (fRequest::isPost()) {
        try {
            $group->populate();
            fRequest::validateCSRFToken(fRequest::get('token'));
            $group->store();
            $group_url = fURL::redirect(Group::makeUrl('list'));
            fMessaging::create('affected', "/" . $group_url, $group->getName());
            fMessaging::create('success', "/" . $group_url, 'The Group ' . $group->getName() . ' was successfully created');
            fURL::redirect($group_url);
            echo "";
        } catch (fExpectedException $e) {
            fMessaging::create('error', fURL::get(), $e->getMessage());
        }
    }
    include VIEW_PATH . '/add_edit_group.php';
} else {
    $groups = Group::findAll();
    include VIEW_PATH . '/list_groups.php';
}
예제 #11
0
 /**
  * Allows the user to view all the user groups registered
  * in the application
  *
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $this->title = '';
     $groupModel = new Group();
     $this->view->paginator = $groupModel->findAll($this->_getPage());
 }