当前位置: 首页>>代码示例>>PHP>>正文


PHP UserGroup::fetch方法代码示例

本文整理汇总了PHP中UserGroup::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP UserGroup::fetch方法的具体用法?PHP UserGroup::fetch怎么用?PHP UserGroup::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserGroup的用法示例。


在下文中一共展示了UserGroup::fetch方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ideaboxGetUserGroupNom

function ideaboxGetUserGroupNom($id)
{
    global $db, $langs;
    if (isset($id) && $id > 0) {
        $usergroup = new UserGroup($db);
        $usergroup->fetch($id);
        return $usergroup->nom;
    } else {
        return false;
    }
}
开发者ID:atm-arnaud,项目名称:dolibarr_module_ideabox,代码行数:11,代码来源:ideabox.lib.php

示例2: getNameUserGroup

 public function getNameUserGroup(&$dolidb)
 {
     $usergroup = new UserGroup($dolidb);
     $usergroup->fetch($this->fk_usergroup);
     return $usergroup->id > 0 ? $usergroup->name : 'Pour tous';
 }
开发者ID:atm-arnaud,项目名称:dolibarr_module_ideabox,代码行数:6,代码来源:ideabox.class.php

示例3: Ldap

{
	$num = $db->num_rows($resql);
	$i = 0;

	$ldap=new Ldap();
	$ldap->connect_bind();

	while ($i < $num)
	{
		$ldap->error="";

		$obj = $db->fetch_object($resql);

		$fgroup = new UserGroup($db);
		$fgroup->id = $obj->rowid;
		$fgroup->fetch($fgroup->id);

		print $langs->trans("UpdateGroup")." rowid=".$fgroup->id." ".$fgroup->name;

		$oldobject=$fgroup;

	    $oldinfo=$oldobject->_load_ldap_info();
	    $olddn=$oldobject->_load_ldap_dn($oldinfo);

	    $info=$fgroup->_load_ldap_info();
		$dn=$fgroup->_load_ldap_dn($info);

		$result=$ldap->add($dn,$info,$user);	// Wil fail if already exists
		$result=$ldap->update($dn,$info,$user,$olddn);
		if ($result > 0)
		{
开发者ID:nrjacker4,项目名称:crm-php,代码行数:31,代码来源:sync_groups_dolibarr2ldap.php

示例4: getHeadForObject

 static function getHeadForObject($tab_object, $fk_object)
 {
     global $db, $conf, $langs, $user;
     $head = array();
     if (empty($tab_object)) {
         return $head;
     }
     if ($tab_object === 'product') {
         dol_include_once('/product/class/product.class.php');
         dol_include_once('/core/lib/product.lib.php');
         $object = new Product($db);
         $object->fetch($fk_object);
         $head = product_prepare_head($object);
     } else {
         if ($tab_object === 'thirdparty') {
             dol_include_once('/societe/class/societe.class.php');
             dol_include_once('/core/lib/company.lib.php');
             $object = new Societe($db);
             $object->fetch($fk_object);
             $head = societe_prepare_head($object);
         } else {
             if ($tab_object === 'contact') {
                 dol_include_once('/contact/class/contact.class.php');
                 dol_include_once('/core/lib/contact.lib.php');
                 $object = new Contact($db);
                 $object->fetch($fk_object);
                 $head = contact_prepare_head($object);
             } else {
                 if ($tab_object === 'user') {
                     dol_include_once('/user/class/user.class.php');
                     dol_include_once('/core/lib/usergroups.lib.php');
                     $object = new User($db);
                     $object->fetch($fk_object);
                     $head = user_prepare_head($object);
                 } else {
                     if ($tab_object === 'group') {
                         dol_include_once('/user/class/usergroup.class.php');
                         dol_include_once('/lib/usergroups.lib.php');
                         $object = new UserGroup($db);
                         $object->fetch($fk_object);
                         $head = group_prepare_head($object);
                     } else {
                         if ($tab_object === 'project') {
                             dol_include_once('/projet/class/project.class.php');
                             dol_include_once('/core/lib/project.lib.php');
                             $object = new Project($db);
                             $object->fetch($fk_object);
                             $head = project_prepare_head($object);
                         }
                     }
                 }
             }
         }
     }
     return $head;
 }
开发者ID:ATM-Consulting,项目名称:dolibarr_module_query,代码行数:56,代码来源:query.class.php

示例5: listGroupsForUser

 /**
  * 	Return array of groups objects for a particular user
  *
  *	@param		int		$userid 	User id to search
  * 	@return		array     			Array of groups objects
  */
 function listGroupsForUser($userid)
 {
     global $conf, $user;
     $ret = array();
     $sql = "SELECT g.rowid, ug.entity as usergroup_entity";
     $sql .= " FROM " . MAIN_DB_PREFIX . "usergroup as g,";
     $sql .= " " . MAIN_DB_PREFIX . "usergroup_user as ug";
     $sql .= " WHERE ug.fk_usergroup = g.rowid";
     $sql .= " AND ug.fk_user = " . $userid;
     if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && !$user->entity) {
         $sql .= " AND g.entity IS NOT NULL";
     } else {
         $sql .= " AND g.entity IN (0," . $conf->entity . ")";
     }
     $sql .= " ORDER BY g.nom";
     dol_syslog(get_class($this) . "::listGroupsForUser", LOG_DEBUG);
     $result = $this->db->query($sql);
     if ($result) {
         while ($obj = $this->db->fetch_object($result)) {
             if (!array_key_exists($obj->rowid, $ret)) {
                 $newgroup = new UserGroup($this->db);
                 $newgroup->fetch($obj->rowid);
                 $ret[$obj->rowid] = $newgroup;
             }
             $ret[$obj->rowid]->usergroup_entity[] = $obj->usergroup_entity;
         }
         $this->db->free($result);
         return $ret;
     } else {
         $this->error = $this->db->lasterror();
         return -1;
     }
 }
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:39,代码来源:usergroup.class.php

示例6: testUserGroupDelete

    /**
     * @depends	testUserGroupOther
     * The depends says test is run only if previous is ok
     */
    public function testUserGroupDelete($id)
    {
    	global $conf,$user,$langs,$db;
		$conf=$this->savconf;
		$user=$this->savuser;
		$langs=$this->savlangs;
		$db=$this->savdb;

		$localobject=new UserGroup($this->savdb);
    	$result=$localobject->fetch($id);
		$result=$localobject->delete($id);

		print __METHOD__." id=".$id." result=".$result."\n";
    	$this->assertLessThan($result, 0);
    	return $result;
    }
开发者ID:remyyounes,项目名称:dolibarr,代码行数:20,代码来源:UserGroupTest.php

示例7: join

            $db->rollback();
            if (is_array($edituser->errors) && count($edituser->errors)) {
                $message = '<div class="error">' . join('<br>', $langs->trans($edituser->errors)) . '</div>';
            } else {
                $message = '<div class="error">' . $langs->trans($edituser->error) . '</div>';
            }
            $action = "create";
            // Go back to create page
        }
    }
}
// Action ajout groupe utilisateur
if (($action == 'addgroup' || $action == 'removegroup') && $caneditfield) {
    if ($group) {
        $editgroup = new UserGroup($db);
        $editgroup->fetch($group);
        $editgroup->oldcopy = dol_clone($editgroup);
        $edituser = new User($db);
        $edituser->fetch($id);
        if ($action == 'addgroup') {
            $edituser->SetInGroup($group, GETPOST('entity'));
        }
        if ($action == 'removegroup') {
            $edituser->RemoveFromGroup($group, GETPOST('entity'));
        }
        if ($result > 0) {
            header("Location: fiche.php?id=" . $id);
            exit;
        } else {
            $message .= $edituser->error;
        }
开发者ID:netors,项目名称:dolibarr,代码行数:31,代码来源:fiche.php

示例8: GETPOST

$userid = GETPOST('userid', 'int');
$socid = GETPOST('socid', 'int');
// Security check
if ($user->societe_id > 0) {
    $action = '';
    $socid = $user->societe_id;
}
$nowyear = strftime("%Y", dol_now());
$year = GETPOST('year') > 0 ? GETPOST('year') : $nowyear;
//$startyear=$year-2;
$startyear = $year - 1;
$endyear = $year;
$includeuserlist = array();
if (!empty($conf->global->LEAD_GRP_USER_AFFECT)) {
    $usergroup = new UserGroup($db);
    $result = $usergroup->fetch($conf->global->LEAD_GRP_USER_AFFECT);
    if ($result < 0) {
        setEventMessage($usergroup->error, 'errors');
    }
    $includeuserlisttmp = $usergroup->listUsersForGroup();
    if (is_array($includeuserlisttmp) && count($includeuserlisttmp) > 0) {
        foreach ($includeuserlisttmp as $usertmp) {
            $includeuserlist[] = $usertmp->id;
        }
    }
}
$langs->load('lead@lead');
llxHeader('', $langs->trans('Module103111Name'));
$stats_lead = new LeadStats($db);
if (!empty($userid) && $userid != -1) {
    $stats_lead->userid = $userid;
开发者ID:BebZ,项目名称:lead,代码行数:31,代码来源:index.php

示例9: Ldap


//.........这里部分代码省略.........
                 $olddn = '';
             }
             $info = $object->_load_ldap_info();
             $dn = $object->_load_ldap_dn($info);
             $result = $ldap->update($dn, $info, $user, $olddn);
             if ($result < 0) {
                 $this->error = "ErrorLDAP " . $ldap->error;
             }
             return $result;
         }
     } elseif ($action == 'USER_ENABLEDISABLE') {
         dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
     } elseif ($action == 'USER_DELETE') {
         dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
         if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
             $ldap = new Ldap();
             $ldap->connect_bind();
             $info = $object->_load_ldap_info();
             $dn = $object->_load_ldap_dn($info);
             $result = $ldap->delete($dn, $info, $user);
             if ($result < 0) {
                 $this->error = "ErrorLDAP " . $ldap->error;
             }
             return $result;
         }
     } elseif ($action == 'USER_SETINGROUP') {
         dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
         if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
             $ldap = new Ldap();
             $ldap->connect_bind();
             // Must edit $object->newgroupid
             $usergroup = new UserGroup($this->db);
             if ($object->newgroupid > 0) {
                 $usergroup->fetch($object->newgroupid);
                 $oldinfo = $usergroup->_load_ldap_info();
                 $olddn = $usergroup->_load_ldap_dn($oldinfo);
                 // Verify if entry exist
                 $container = $usergroup->_load_ldap_dn($oldinfo, 1);
                 $search = "(" . $usergroup->_load_ldap_dn($oldinfo, 2) . ")";
                 $records = $ldap->search($container, $search);
                 if (count($records) && $records['count'] == 0) {
                     $olddn = '';
                 }
                 $info = $usergroup->_load_ldap_info();
                 // Contains all members, included the new one (insert already done before trigger call)
                 $dn = $usergroup->_load_ldap_dn($info);
                 $result = $ldap->update($dn, $info, $user, $olddn);
                 if ($result < 0) {
                     $this->error = "ErrorLDAP " . $ldap->error;
                 }
             }
             return $result;
         }
     } elseif ($action == 'USER_REMOVEFROMGROUP') {
         dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
         if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') {
             $ldap = new Ldap();
             $ldap->connect_bind();
             // Must edit $object->newgroupid
             $usergroup = new UserGroup($this->db);
             if ($object->oldgroupid > 0) {
                 $usergroup->fetch($object->oldgroupid);
                 $oldinfo = $usergroup->_load_ldap_info();
                 $olddn = $usergroup->_load_ldap_dn($oldinfo);
                 // Verify if entry exist
                 $container = $usergroup->_load_ldap_dn($oldinfo, 1);
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:67,代码来源:interface_50_modLdap_Ldapsynchro.class.php

示例10: exit

    print $langs->trans("Error") . ': ' . $langs->trans("LDAP setup for groups not defined inside Dolibarr");
    exit(-1);
}
$ldap = new Ldap();
$result = $ldap->connect_bind();
if ($result >= 0) {
    $justthese = array();
    // We disable synchro Dolibarr-LDAP
    $conf->global->LDAP_SYNCHRO_ACTIVE = 0;
    $ldaprecords = $ldap->getRecords('*', $conf->global->LDAP_GROUP_DN, $conf->global->LDAP_KEY_GROUPS, $required_fields, 0, array($conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS));
    if (is_array($ldaprecords)) {
        $db->begin();
        // Warning $ldapuser has a key in lowercase
        foreach ($ldaprecords as $key => $ldapgroup) {
            $group = new UserGroup($db);
            $group->fetch('', $ldapgroup[$conf->global->LDAP_KEY_GROUPS]);
            $group->name = $ldapgroup[$conf->global->LDAP_GROUP_FIELD_FULLNAME];
            $group->nom = $group->name;
            // For backward compatibility
            $group->note = $ldapgroup[$conf->global->LDAP_GROUP_FIELD_DESCRIPTION];
            $group->entity = $conf->entity;
            //print_r($ldapgroup);
            if ($group->id > 0) {
                // Group update
                print $langs->transnoentities("GroupUpdate") . ' # ' . $key . ': name=' . $group->name;
                $res = $group->update();
                if ($res > 0) {
                    print ' --> Updated group id=' . $group->id . ' name=' . $group->name;
                } else {
                    $error++;
                    print ' --> ' . $res . ' ' . $group->error;
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:31,代码来源:sync_groups_ldap2dolibarr.php

示例11: fopen

$sql = "SELECT uid,rowid, title, fk_usergroup,fk_user_author FROM " . MAIN_DB_PREFIX . "qdashboard WHERE send_by_mail = '" . $frequence . "' AND fk_usergroup>0";
$Tab = $PDOdb->ExecuteAsArray($sql);
$f1 = fopen('files/convert.sh', 'w');
fputs($f1, "cd " . __DIR__ . "/files \n");
//	var_dump($sql,$Tab);
foreach ($Tab as $row) {
    $author = new User($db);
    $author->fetch($row->fk_user_author);
    //var_dump(  is_file( 'files/'.$row->uid.'.pdf'), dol_buildpath('/query/files/'.$row->uid.'.pdf') );
    if ($step == 1) {
        $url = dol_buildpath('/query/dashboard.php', 2) . '?action=run&uid=' . $row->uid;
        //echo $url;
        fputs($f1, "wkhtmltopdf --orientation Landscape " . escapeshellarg($url) . " " . $row->uid . ".pdf  \n");
    } elseif ($step == 2 && is_file(dol_buildpath('/query/files/' . $row->uid . '.pdf'))) {
        $g = new UserGroup($db);
        if ($g->fetch($row->fk_usergroup) > 0) {
            $TUser = $g->listUsersForGroup();
            foreach ($TUser as &$u) {
                if ($u->statut == 1) {
                    $mailto = $u->email;
                    if (!empty($mailto)) {
                        print "{$mailto} \n";
                        $m = new TReponseMail($author->email, $mailto, $langs->trans('Report') . ' : ' . $row->title, $langs->trans('PleaseFindYourReportHasAttachement') . " : " . dol_buildpath('/query/dashboard.php?action=run&id=' . $row->rowid, 2));
                        $m->add_piece_jointe($row->uid . '.pdf', dol_buildpath('/query/files/' . $row->uid . '.pdf'));
                        $m->send();
                    }
                }
            }
        }
        unlink(dol_buildpath('/query/files/' . $row->uid . '.pdf'));
        // suppresion du pdf après envoi par mail
开发者ID:ATM-Consulting,项目名称:dolibarr_module_query,代码行数:31,代码来源:mail-dashboard.php

示例12: listGroupsForUser

	/**
	 * 	Return array of groups objects for a particular user
	 *	@param		userid    User id to search
	 * 	@return		array     Array of groups objects
	 */
	function listGroupsForUser($userid)
	{
		global $conf;

		$ret=array();

		$sql = "SELECT g.rowid, ug.entity as usergroup_entity";
		$sql.= " FROM ".MAIN_DB_PREFIX."usergroup as g,";
		$sql.= " ".MAIN_DB_PREFIX."usergroup_user as ug";
		$sql.= " WHERE ug.fk_usergroup = g.rowid";
		$sql.= " AND ug.fk_user = ".$userid;
		$sql.= " AND ug.entity IN (0,".$conf->entity.")";
		$sql.= " ORDER BY g.nom";

		dol_syslog("UserGroup::listGroupsForUser sql=".$sql,LOG_DEBUG);
		$result = $this->db->query($sql);
		if ($result)
		{
			while ($obj = $this->db->fetch_object($result))
			{
				$group=new UserGroup($this->db);
				$group->fetch($obj->rowid);
				$group->usergroup_entity = $obj->usergroup_entity;

				$ret[]=$group;
			}

			$this->db->free($result);

			return $ret;
		}
		else
		{
			$this->error=$this->db->lasterror();
			dol_syslog("UserGroup::listGroupsForUser ".$this->error, LOG_ERR);
			return -1;
		}
	}
开发者ID:remyyounes,项目名称:dolibarr,代码行数:43,代码来源:usergroup.class.php


注:本文中的UserGroup::fetch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。