Example #1
0
		<?php 
if ($group_transfer === true) {
    ?>
			<label class="checkbox-inline"><input type = "radio" name="assigned_to_selector" value="user" CHECKED><?php 
    echo _('User');
    ?>
</label>
			<label class="checkbox-inline"><input type = "radio" name="assigned_to_selector" value="group"><?php 
    echo _('Group');
    ?>
</label>
			<br /><br />
			<div id="user_selector_block">
				<select name="user_selector" id="user_selector" class="form-control input-sm">
				<?php 
    while ($do_user->next()) {
        $user_dis = $do_user->firstname . ' ' . $do_user->lastname . ' (' . $do_user->user_name . ' )';
        ?>
					<option value="<?php 
        echo $do_user->iduser;
        ?>
"><?php 
        echo $user_dis;
        ?>
</option>
				<?php 
    }
    ?>
				</select>
			</div>
			<div id="group_selector_block" style="display:none;">
<?php

/** Ofuz Open Source version is released under the GNU Affero General Public License, please read the full license at: http://www.gnu.org/licenses/agpl-3.0.html **/
// Copyright 2008 - 2010 all rights reserved, SQLFusion LLC, info@sqlfusion.com
/** Ofuz Open Source version is released under the GNU Affero General Public License, please read the full license at: http://www.gnu.org/licenses/agpl-3.0.html **/
/**
 * Rebuild the user contacts table
 * User contacts are accessed from the tables by userid<iduser>_contact
 * The contact table is updated for all the contact related operation and also the user contact table is getting updated on
 * add/edit/delete operation of contact, tag etc.
 * To make it more reliable the following script is used. This is rebuilt all the user contact tables.
 * This script is intensive as the volume of contact and user increases.
 * Wise to set the script once in a week. Also we can ignore rebuiling of user contact tables who have not logged in in certain period by passing the parameter
 * in getUserLoggedInWithinPeriod() default is 7 days
 * @see class/Contact.class.php
 * @see class/ContactView.class.php
 *
 */
include_once "config.php";
$contact_view = new ContactView();
set_time_limit(36000);
$user = new User();
$user->getUserLoggedInWithinPeriod();
while ($user->next()) {
    // if($user->iduser == 20 ){
    echo "\n<br>User id:" . $user->iduser . " Name:" . $user->firstname . " " . $user->lastname;
    $contact_view->setUser($user->iduser);
    $contact_view->rebuildContactUserTable();
    //  }
}
Example #3
0
    /**
     * Static function to display form for the field type
     * @param string $value
     * @param string $css
     * @return html for the form containing the field
     */
    public static function display_field($value = '', $css = '', $idmodule)
    {
        // make sure group option is disabled for sharing rule "Only Me" @v-0.9
        $module_data_share_permissions = $_SESSION["do_user"]->get_module_data_share_permissions();
        $hide_group = false;
        if ($module_data_share_permissions[$idmodule] == 5) {
            $hide_group = true;
        }
        $html = '';
        $assigned_to_type = '';
        $do_user = new User();
        $do_group = new Group();
        $do_user->get_all_users();
        $do_group->get_all_groups();
        $assigned_to_selector_userschecked = '';
        $assigned_to_selector_groupchecked = '';
        $assigned_to_show_userlist = 'style="display:none;"';
        $assigned_to_show_grouplist = 'style="display:none;"';
        if ($value == '') {
            $assigned_to = $_SESSION["do_user"]->iduser;
            $assigned_to_selector_userschecked = "CHECKED";
            $assigned_to_show_userlist = 'style="display:block;"';
        } else {
            if (preg_match("/user_/", $value, $matches)) {
                $assigned_to_type = 'user';
            } elseif (preg_match("/group_/", $value, $matches)) {
                $assigned_to_type = 'group';
            }
            $val_exploded = explode("_", $value);
            $assigned_to = $val_exploded[1];
            if ($assigned_to_type == 'user') {
                $assigned_to_selector_userschecked = "CHECKED";
                $assigned_to_show_userlist = 'style="display:block;"';
            } elseif ($assigned_to_type == 'group') {
                $assigned_to_selector_groupchecked = "CHECKED";
                $assigned_to_show_grouplist = 'style="display:block;"';
            }
        }
        //$html .= '<div class="btn-group" data-toggle="buttons-radio">';
        $html .= '<label class="checkbox-inline"><input type = "radio" name="assigned_to_selector" value="user" ' . $assigned_to_selector_userschecked . '>' . _('User') . '</label>';
        if (false === $hide_group) {
            $html .= '<label class="checkbox-inline"><input type = "radio" name="assigned_to_selector" value="group" ' . $assigned_to_selector_groupchecked . '>' . _('Group') . '</label>';
        }
        //$html .= '</div>';
        $html .= '<div id="user_selector_block" ' . $assigned_to_show_userlist . '>';
        $html .= '<select name="user_selector" id="user_selector" class="form-control input-sm">';
        while ($do_user->next()) {
            $selected = '';
            if ($assigned_to == $do_user->iduser) {
                $selected = "SELECTED";
            }
            $html .= '<option value="' . $do_user->iduser . '" ' . $selected . '>' . $do_user->firstname . ' ' . $do_user->lastname . ' (' . $do_user->user_name . ')</option>';
        }
        $html .= '</select>';
        $html .= '</div>';
        $html .= '<div id="group_selector_block" ' . $assigned_to_show_grouplist . '>';
        $html .= '<select name="group_selector" id="group_selector" class="form-control input-sm">';
        while ($do_group->next()) {
            $selected = '';
            if ($assigned_to == $do_group->idgroup) {
                $selected = "SELECTED";
            }
            $html .= '<option value="' . $do_group->idgroup . '" ' . $selected . '>' . $do_group->group_name . '</option>';
        }
        $html .= '</select>';
        $html .= '</div>';
        $html .= "\n" . '<script>
			$("input[name=\'assigned_to_selector\']").bind("click",assigned_to_selector_clicked);
				function assigned_to_selector_clicked(){
					if ($(this).val() == \'group\') {
						$("#user_selector_block").hide();
						$("#group_selector_block").show();
					}
					if ($(this).val() == \'user\') {
						$("#user_selector_block").show();
						$("#group_selector_block").hide();
					}
			}';
        $html .= "\n" . '</script>';
        echo $html;
    }
Example #4
0
        pieError('UserNotDeletable');
    }
    pieNotice('UserDeleted');
} elseif (@$_REQUEST['user']) {
    // Ask for approval to delete user.
    pieNotice('AskApproval');
} else {
    // Display a list of users to choose from.
    $ip = pieMakeString('[[$^icon_link]]');
    $hint_delete = $GLOBALS['pie']['locale']->key("Delete");
    $user = new User();
    $map = new MapFile();
    $n = 0;
    $admins = explode(',', $GLOBALS['pie']['admin_list']);
    $list = array();
    for ($name = $user->first(); $name; $name = $user->next()) {
        if (in_array($name, $admins)) {
            continue;
        }
        $list[] = $name;
    }
    if (!count($list)) {
        pieError('NoUsers');
    }
    pieNotice("TableHead");
    sort($list);
    foreach ($list as $name) {
        $n++;
        print '<tr class="' . ($n % 2 ? "oddRow" : "evenRow") . '">' . "<td>" . pieMakeLink(htmlspecialchars($name), array('user' => $name, 'action' => "userinfo"), array('class' => "itemLink")) . "</td>\n" . '<td style="text-align: center;">' . pieMakeLink("<img src=\"{$ip}/delete.png\" alt=\"{$hint_delete}\" />", array('action' => "userdel", 'user' => $name), array('title' => $hint_delete)) . "</td>\n" . "</tr>\n";
    }
    print "</table>\n";