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


PHP Contact::fetch方法代码示例

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


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

示例1: delete

 /**
  * Delete contact
  *
  * @param   int     $id Contact ID
  * @return  array
  * 
  * @url	DELETE contact/{id}
  */
 function delete($id)
 {
     if (!DolibarrApiAccess::$user->rights->contact->supprimer) {
         throw new RestException(401);
     }
     $result = $this->contact->fetch($id);
     if (!$result) {
         throw new RestException(404, 'Contact not found');
     }
     if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id, 'socpeople&societe')) {
         throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
     }
     return $this->contact->delete($id);
 }
开发者ID:Samara94,项目名称:dolibarr,代码行数:22,代码来源:api_contact.class.php

示例2: getObject

 /**
  *  Get object
  *
  *  @param	int		$id		Object id
  *  @return	object			Object loaded
  */
 function getObject($id)
 {
     $ret = $this->getInstanceDao();
     if (is_object($this->object) && method_exists($this->object, 'fetch')) {
         if (!empty($id)) {
             $this->object->fetch($id);
         }
     } else {
         $object = new Contact($this->db);
         if (!empty($id)) {
             $object->fetch($id);
         }
         $this->object = $object;
     }
 }
开发者ID:Samara94,项目名称:dolibarr,代码行数:21,代码来源:actions_contactcard_common.class.php

示例3: json

 public function json()
 {
     // find out who is light and who is heavy
     // (light => less than 0.66 * (80th percentile))
     $nass = array();
     foreach ($this->r as $cid => $x) {
         $nass[] = count($x);
     }
     sort($nass);
     $heavy_boundary = 0;
     if (count($nass)) {
         $heavy_boundary = 0.66 * $nass[(int) (0.8 * count($nass))];
     }
     $contacts = pcMembers();
     $need_contacts = [];
     foreach ($this->r as $cid => $x) {
         if (!isset($contacts[$cid]) && ctype_digit($cid)) {
             $need_contacts[] = $cid;
         }
     }
     if (count($need_contacts)) {
         $result = Dbl::q("select firstName, lastName, affiliation, email, contactId, roles, contactTags, disabled from ContactInfo where contactId ?a", $need_contacts);
         while ($result && ($row = Contact::fetch($result))) {
             $contacts[$row->contactId] = $row;
         }
     }
     $users = array();
     $tags = $this->contact->can_view_reviewer_tags();
     foreach ($this->r as $cid => $x) {
         if ($cid != "conflicts") {
             $users[$cid] = $u = (object) array();
             $p = get($contacts, $cid);
             if ($p) {
                 $u->name = Text::name_text($p);
             }
             if (count($x) < $heavy_boundary) {
                 $u->light = true;
             }
             if ($p && $tags && ($t = $p->viewable_color_classes($this->contact))) {
                 $u->color_classes = $t;
             }
         }
     }
     return (object) array("reviews" => $this->r, "deadlines" => $this->dl, "users" => $users);
 }
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:45,代码来源:reviewtimes.php

示例4: modify_password_mail

 private static function modify_password_mail($where, $dopassword, $sendtype, $ids)
 {
     $j = (object) array("ok" => true);
     $result = Dbl::qe("select * from ContactInfo where {$where} and contactId ?a", $ids);
     while ($result && ($Acct = Contact::fetch($result))) {
         if ($dopassword) {
             $Acct->change_password(null, null, Contact::CHANGE_PASSWORD_NO_CDB);
         }
         if ($sendtype && !$Acct->disabled) {
             $Acct->sendAccountInfo($sendtype, false);
         } else {
             if ($sendtype) {
                 $j->warnings[] = "Not sending mail to disabled account " . htmlspecialchars($Acct->email) . ".";
             }
         }
     }
     return $j;
 }
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:18,代码来源:useractions.php

示例5: show_day_events

/**
 * Show event of a particular day
 *
 * @param	DoliDB	$db              Database handler
 * @param   int		$day             Day
 * @param   int		$month           Month
 * @param   int		$year            Year
 * @param   int		$monthshown      Current month shown in calendar view
 * @param   string	$style           Style to use for this day
 * @param   array	$eventarray      Array of events
 * @param   int		$maxprint        Nb of actions to show each day on month view (0 means no limit)
 * @param   int		$maxnbofchar     Nb of characters to show for event line
 * @param   string	$newparam        Parameters on current URL
 * @param   int		$showinfo        Add extended information (used by day and week view)
 * @param   int		$minheight       Minimum height for each event. 60px by default.
 * @return	void
 */
function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam = '', $showinfo = 0, $minheight = 60)
{
    global $user, $conf, $langs;
    global $action, $filter, $filtert, $status, $actioncode;
    // Filters used into search form
    global $theme_datacolor;
    global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused;
    print "\n" . '<div id="dayevent_' . sprintf("%04d", $year) . sprintf("%02d", $month) . sprintf("%02d", $day) . '" class="dayevent">';
    // Line with title of day
    $curtime = dol_mktime(0, 0, 0, $month, $day, $year);
    print '<table class="nobordernopadding" width="100%">' . "\n";
    print '<tr><td align="left" class="nowrap">';
    print '<a href="' . DOL_URL_ROOT . '/comm/action/index.php?';
    print 'action=show_day&day=' . str_pad($day, 2, "0", STR_PAD_LEFT) . '&month=' . str_pad($month, 2, "0", STR_PAD_LEFT) . '&year=' . $year;
    print $newparam;
    print '">';
    if ($showinfo) {
        print dol_print_date($curtime, 'daytextshort');
    } else {
        print dol_print_date($curtime, '%d');
    }
    print '</a>';
    print '</td><td align="right" class="nowrap">';
    if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) {
        $newparam .= '&month=' . str_pad($month, 2, "0", STR_PAD_LEFT) . '&year=' . $year;
        //$param='month='.$monthshown.'&year='.$year;
        $hourminsec = '100000';
        print '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&datep=' . sprintf("%04d%02d%02d", $year, $month, $day) . $hourminsec . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . ($newparam ? '?' . $newparam : '')) . '">';
        print img_picto($langs->trans("NewAction"), 'edit_add.png');
        print '</a>';
    }
    print '</td></tr>' . "\n";
    // Line with td contains all div of each events
    print '<tr height="' . $minheight . '"><td valign="top" colspan="2" class="sortable" style="padding-bottom: 2px;">';
    print '<div style="width: 100%; position: relative;">';
    //$curtime = dol_mktime (0, 0, 0, $month, $day, $year);
    $i = 0;
    $nummytasks = 0;
    $numother = 0;
    $numbirthday = 0;
    $numical = 0;
    $numicals = array();
    $ymd = sprintf("%04d", $year) . sprintf("%02d", $month) . sprintf("%02d", $day);
    $nextindextouse = count($colorindexused);
    // At first run this is 0, so fist user has 0, next 1, ...
    //print $nextindextouse;
    foreach ($eventarray as $daykey => $notused) {
        $annee = date('Y', $daykey);
        $mois = date('m', $daykey);
        $jour = date('d', $daykey);
        if ($day == $jour && $month == $mois && $year == $annee) {
            foreach ($eventarray[$daykey] as $index => $event) {
                if ($i < $maxprint || $maxprint == 0 || !empty($conf->global->MAIN_JS_SWITCH_AGENDA)) {
                    $keysofuserassigned = array_keys($event->userassigned);
                    $ponct = $event->date_start_in_calendar == $event->date_end_in_calendar;
                    // Define $color (Hex string like '0088FF') and $cssclass of event
                    $color = -1;
                    $colorindex = -1;
                    if (in_array($user->id, $keysofuserassigned)) {
                        $nummytasks++;
                        $cssclass = 'family_mytasks';
                        if (empty($cacheusers[$event->userownerid])) {
                            $newuser = new User($db);
                            $newuser->fetch($event->userownerid);
                            $cacheusers[$event->userownerid] = $newuser;
                        }
                        //var_dump($cacheusers[$event->userownerid]->color);
                        // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event)
                        if (!empty($cacheusers[$event->userownerid]->color)) {
                            $color = $cacheusers[$event->userownerid]->color;
                        }
                    } else {
                        if ($event->type_code == 'ICALEVENT') {
                            $numical++;
                            if (!empty($event->icalname)) {
                                if (!isset($numicals[dol_string_nospecial($event->icalname)])) {
                                    $numicals[dol_string_nospecial($event->icalname)] = 0;
                                }
                                $numicals[dol_string_nospecial($event->icalname)]++;
                            }
                            $color = $event->icalcolor;
                            $cssclass = !empty($event->icalname) ? 'family_ext' . md5($event->icalname) : 'family_other';
                        } else {
//.........这里部分代码省略.........
开发者ID:Albertopf,项目名称:prueba,代码行数:101,代码来源:index.php

示例6: requestReview

function requestReview($email)
{
    global $Conf, $Me, $Error, $prow;
    $Them = Contact::create(array("name" => @$_REQUEST["name"], "email" => $email));
    if (!$Them) {
        if (trim($email) === "" || !validate_email($email)) {
            Conf::msg_error("“" . htmlspecialchars(trim($email)) . "” is not a valid email address.");
            $Error["email"] = true;
        } else {
            Conf::msg_error("Error while finding account for “" . htmlspecialchars(trim($email)) . ".”");
        }
        return false;
    }
    $reason = trim(defval($_REQUEST, "reason", ""));
    $round = $Conf->current_round();
    if (isset($_REQUEST["round"]) && $_REQUEST["round"] != "" && ($rname = $Conf->sanitize_round_name($_REQUEST["round"])) !== false) {
        $round = $Conf->round_number($rname, false);
    }
    // look up the requester
    $Requester = $Me;
    if ($Conf->setting("extrev_chairreq")) {
        $result = Dbl::qe("select firstName, lastName, u.email, u.contactId from ReviewRequest rr join ContactInfo u on (u.contactId=rr.requestedBy) where paperId={$prow->paperId} and rr.email=?", $Them->email);
        if ($result && ($recorded_requester = Contact::fetch($result))) {
            $Requester = $recorded_requester;
        }
    }
    Dbl::qe_raw("lock tables PaperReview write, PaperReviewRefused write, ReviewRequest write, ContactInfo read, PaperConflict read, ActionLog write");
    // NB caller unlocks tables on error
    // check for outstanding review request
    if (!($result = requestReviewChecks(Text::user_html($Them), $Them->contactId))) {
        return $result;
    }
    // at this point, we think we've succeeded.
    // store the review request
    $Me->assign_review($prow->paperId, $Them->contactId, REVIEW_EXTERNAL, ["mark_notify" => true, "requester_contact" => $Requester, "requested_email" => $Them->email, "round_number" => $round]);
    Dbl::qx_raw("unlock tables");
    // send confirmation email
    HotCRPMailer::send_to($Them, "@requestreview", $prow, array("requester_contact" => $Requester, "other_contact" => $Requester, "reason" => $reason));
    $Conf->confirmMsg("Created a request to review paper #{$prow->paperId}.");
    return true;
}
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:41,代码来源:assign.php

示例7: Task

 /**
  *	Function to build a document on disk using the generic odt module.
  *
  *	@param	Commande	$object					Object source to build document
  *	@param	Translate	$outputlangs			Lang output object
  * 	@param	string		$srctemplatepath	    Full path of source filename for generator using a template file
  *	@return	int         						1 if OK, <=0 if KO
  */
 function write_file($object, $outputlangs, $srctemplatepath)
 {
     global $user, $langs, $conf, $mysoc, $hookmanager;
     if (empty($srctemplatepath)) {
         dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
         return -1;
     }
     if (!is_object($outputlangs)) {
         $outputlangs = $langs;
     }
     $sav_charset_output = $outputlangs->charset_output;
     $outputlangs->charset_output = 'UTF-8';
     $outputlangs->load("main");
     $outputlangs->load("dict");
     $outputlangs->load("companies");
     $outputlangs->load("projects");
     if ($conf->projet->dir_output) {
         // If $object is id instead of object
         if (!is_object($object)) {
             $id = $object;
             $object = new Task($this->db);
             $result = $object->fetch($id);
             if ($result < 0) {
                 dol_print_error($this->db, $object->error);
                 return -1;
             }
         }
         $project = new Project($this->db);
         $project->fetch($object->fk_project);
         $dir = $conf->projet->dir_output . "/" . $project->ref . "/";
         $objectref = dol_sanitizeFileName($object->ref);
         if (!preg_match('/specimen/i', $objectref)) {
             $dir .= "/" . $objectref;
         }
         $file = $dir . "/" . $objectref . ".odt";
         if (!file_exists($dir)) {
             print '$dir' . $dir;
             if (dol_mkdir($dir) < 0) {
                 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
                 return -1;
             }
         }
         if (file_exists($dir)) {
             //print "srctemplatepath=".$srctemplatepath;	// Src filename
             $newfile = basename($srctemplatepath);
             $newfiletmp = preg_replace('/\\.(ods|odt)/i', '', $newfile);
             $newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
             $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
             $newfiletmp = $objectref . '_' . $newfiletmp;
             //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
             $file = $dir . '/' . $newfiletmp . '.odt';
             //print "newdir=".$dir;
             //print "newfile=".$newfile;
             //print "file=".$file;
             //print "conf->societe->dir_temp=".$conf->societe->dir_temp;
             dol_mkdir($conf->projet->dir_temp);
             $socobject = $object->thirdparty;
             // Make substitution
             $substitutionarray = array('__FROM_NAME__' => $this->emetteur->name, '__FROM_EMAIL__' => $this->emetteur->email);
             complete_substitutions_array($substitutionarray, $langs, $object);
             // Open and load template
             require_once ODTPHP_PATH . 'odf.php';
             try {
                 $odfHandler = new odf($srctemplatepath, array('PATH_TO_TMP' => $conf->projet->dir_temp, 'ZIP_PROXY' => 'PclZipProxy', 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}'));
             } catch (Exception $e) {
                 $this->error = $e->getMessage();
                 return -1;
             }
             // After construction $odfHandler->contentXml contains content and
             // [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by
             // [!-- BEGIN lines --]*[!-- END lines --]
             //print html_entity_decode($odfHandler->__toString());
             //print exit;
             // Make substitutions into odt of user info
             $array_user = $this->get_substitutionarray_user($user, $outputlangs);
             $array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs);
             $array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs);
             $array_objet = $this->get_substitutionarray_object($project, $outputlangs);
             $array_other = $this->get_substitutionarray_other($outputlangs);
             $tmparray = array_merge($array_user, $array_soc, $array_thirdparty, $array_objet, $array_other);
             complete_substitutions_array($tmparray, $outputlangs, $object);
             foreach ($tmparray as $key => $value) {
                 try {
                     if (preg_match('/logo$/', $key)) {
                         if (file_exists($value)) {
                             $odfHandler->setImage($key, $value);
                         } else {
                             $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
                         }
                     } else {
                         $odfHandler->setVars($key, $value, true, 'UTF-8');
                     }
//.........这里部分代码省略.........
开发者ID:Samara94,项目名称:dolibarr,代码行数:101,代码来源:doc_generic_task_odt.modules.php

示例8: 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

示例9: array

 $formmail->substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name;
 $formmail->substit['__PROJECT_REF__'] = is_object($object->projet) ? $object->projet->ref : '';
 $formmail->substit['__PROJECT_NAME__'] = is_object($object->projet) ? $object->projet->title : '';
 $formmail->substit['__PERSONALIZED__'] = '';
 $formmail->substit['__CONTACTCIVNAME__'] = '';
 // Find the good contact adress
 $custcontact = '';
 $contactarr = array();
 $contactarr = $object->liste_contact(-1, 'external');
 if (is_array($contactarr) && count($contactarr) > 0) {
     foreach ($contactarr as $contact) {
         if ($contact['libelle'] == $langs->trans('TypeContact_facture_external_BILLING')) {
             // TODO Use code and not label
             require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
             $contactstatic = new Contact($db);
             $contactstatic->fetch($contact['id']);
             $custcontact = $contactstatic->getFullName($langs, 1);
         }
     }
     if (!empty($custcontact)) {
         $formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
     }
 }
 // Tableau des parametres complementaires du post
 $formmail->param['action'] = $action;
 $formmail->param['models'] = $modelmail;
 $formmail->param['models_id'] = GETPOST('modelmailselected', 'int');
 $formmail->param['facid'] = $object->id;
 $formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
 // Init list of files
 if (GETPOST("mode") == 'init') {
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:facture.php

示例10: isset

require_once DOL_DOCUMENT_ROOT . "/contact/class/contact.class.php";
require_once DOL_DOCUMENT_ROOT . "/core/lib/contact.lib.php";
$langs->load("companies");
// Security check
$contactid = isset($_GET["id"]) ? $_GET["id"] : '';
if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'contact', $contactid, 'socpeople&societe');
/*
 *	View
 */
llxHeader('', $langs->trans("ContactsAddresses"), 'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas');
$form = new Form($db);
$contact = new Contact($db);
$contact->fetch($_GET["id"], $user);
$head = contact_prepare_head($contact);
dol_fiche_head($head, 'exportimport', $langs->trans("ContactsAddresses"), 0, 'contact');
/*
 * Fiche en mode visu
 */
print '<table class="border" width="100%">';
// Ref
print '<tr><td>' . $langs->trans("Ref") . '</td><td colspan="3">';
print $form->showrefnav($contact, 'id');
print '</td></tr>';
// Name
print '<tr><td width="20%">' . $langs->trans("Lastname") . ' / ' . $langs->trans("Label") . '</td><td>' . $contact->name . '</td>';
print '<td width="20%">' . $langs->trans("Firstname") . '</td><td width="25%">' . $contact->firstname . '</td></tr>';
// Company
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
开发者ID:nrjacker4,项目名称:crm-php,代码行数:31,代码来源:exportimport.php

示例11: array

// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('contact');
$search_array_options = $extrafields->getOptionalsFromPost($extralabels, '', 'search_');
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array('p.lastname' => 'Lastname', 'p.firstname' => 'Firstname', 'p.email' => 'EMail', 's.nom' => "ThirdParty");
// Definition of fields for list
$arrayfields = array('p.lastname' => array('label' => $langs->trans("Lastname"), 'checked' => 1), 'p.firstname' => array('label' => $langs->trans("Firsname"), 'checked' => 1), 'p.poste' => array('label' => $langs->trans("Post"), 'checked' => 1), 'p.town' => array('label' => $langs->trans("Town"), 'checked' => 0), 'p.zip' => array('label' => $langs->trans("Zip"), 'checked' => 0), 'p.phone' => array('label' => $langs->trans("PhonePro"), 'checked' => 1), 'p.phone_perso' => array('label' => $langs->trans("PhonePerso"), 'checked' => 0), 'p.phone_mobile' => array('label' => $langs->trans("PhoneMobile"), 'checked' => 1), 'p.fax' => array('label' => $langs->trans("Fax"), 'checked' => 1), 'p.email' => array('label' => $langs->trans("Email"), 'checked' => 1), 'p.skype' => array('label' => $langs->trans("Skype"), 'checked' => 1, 'enabled' => !empty($conf->skype->enabled)), 'p.thirdparty' => array('label' => $langs->trans("ThirdParty"), 'checked' => 1, 'enabled' => empty($conf->global->SOCIETE_DISABLE_CONTACTS)), 'p.priv' => array('label' => $langs->trans("ContactVisibility"), 'checked' => 1, 'position' => 200), 'p.datec' => array('label' => $langs->trans("DateCreation"), 'checked' => 0, 'position' => 500), 'p.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => 0, 'position' => 500), 'p.statut' => array('label' => $langs->trans("Status"), 'checked' => 1, 'position' => 1000));
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {
    foreach ($extrafields->attribute_label as $key => $val) {
        $arrayfields["ef." . $key] = array('label' => $extrafields->attribute_label[$key], 'checked' => $extrafields->attribute_list[$key], 'position' => $extrafields->attribute_pos[$key], 'enabled' => $extrafields->attribute_perms[$key]);
    }
}
$object = new Contact($db);
if (($id > 0 || !empty($ref)) && $action != 'add') {
    $result = $object->fetch($id, $ref);
    if ($result < 0) {
        dol_print_error($db);
    }
}
/*
 * Actions
 */
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
// Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
    setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php';
if (empty($reshook)) {
开发者ID:Albertopf,项目名称:prueba,代码行数:31,代码来源:list.php

示例12: show_pset_table

function show_pset_table($pset)
{
    global $Conf, $Me, $Now, $Profile, $LastPsetFix;
    echo '<div id="', $pset->urlkey, '">';
    echo "<h3>", htmlspecialchars($pset->title), "</h3>";
    if ($Me->privChair) {
        show_pset_actions($pset);
    }
    if ($pset->disabled) {
        echo "</div>\n";
        return;
    }
    $t0 = $Profile ? microtime(true) : 0;
    // load students
    if ($Conf->opt("restrictRepoView")) {
        $view = "l2.link repoviewable";
        $viewjoin = "left join ContactLink l2 on (l2.cid=c.contactId and l2.type=" . LINK_REPOVIEW . " and l2.link=l.link)\n";
    } else {
        $view = "4 repoviewable";
        $viewjoin = "";
    }
    $result = Dbl::qe("select c.contactId, c.firstName, c.lastName, c.email,\n\tc.huid, c.github_username, c.seascode_username, c.anon_username, c.extension, c.disabled, c.dropped, c.roles, c.contactTags,\n\tgroup_concat(pl.link) pcid, group_concat(rpl.link) rpcid,\n\tr.repoid, r.cacheid, r.heads, r.url, r.open, r.working, r.lastpset, r.snapcheckat, {$view},\n\trg.gradehash, rg.gradercid, rg.placeholder, rg.placeholder_at\n\tfrom ContactInfo c\n\tleft join ContactLink l on (l.cid=c.contactId and l.type=" . LINK_REPO . " and l.pset={$pset->id})\n\t{$viewjoin}\n\tleft join Repository r on (r.repoid=l.link)\n\tleft join ContactLink pl on (pl.cid=c.contactId and pl.type=" . LINK_PARTNER . " and pl.pset={$pset->id})\n\tleft join ContactLink rpl on (rpl.cid=c.contactId and rpl.type=" . LINK_BACKPARTNER . " and rpl.pset={$pset->id})\n\tleft join RepositoryGrade rg on (rg.repoid=r.repoid and rg.pset={$pset->id})\n\twhere (c.roles&" . Contact::ROLE_PCLIKE . ")=0\n\tand (rg.repoid is not null or not c.dropped)\n\tgroup by c.contactId, r.repoid");
    $t1 = $Profile ? microtime(true) : 0;
    $anonymous = $pset->anonymous;
    if (req("anonymous") !== null && $Me->privChair) {
        $anonymous = !!req("anonymous");
    }
    $students = array();
    while ($result && ($s = Contact::fetch($result))) {
        $s->set_anonymous($anonymous);
        Contact::set_sorter($s, req("sort"));
        $students[$s->contactId] = $s;
        // maybe lastpset links are out of order
        if ($s->lastpset < $pset) {
            $LastPsetFix = true;
        }
    }
    uasort($students, "Contact::compare");
    $checkbox = $Me->privChair || !$pset->gitless && $pset->runners;
    $rows = array();
    $max_ncol = 0;
    $incomplete = array();
    $pcmembers = pcMembers();
    $jx = [];
    foreach ($students as $s) {
        if (!$s->visited) {
            $row = (object) ["student" => $s, "text" => "", "ptext" => []];
            $j = render_pset_row($pset, $students, $s, $row, $pcmembers, $anonymous);
            if ($s->pcid) {
                foreach (array_unique(explode(",", $s->pcid)) as $pcid) {
                    if (isset($students[$pcid])) {
                        $jj = render_pset_row($pset, $students, $students[$pcid], $row, $pcmembers, $anonymous);
                        $j["partners"][] = $jj;
                    }
                }
            }
            if ($row->sortprefix) {
                $j["boring"] = true;
            }
            $jx[$row->sortprefix . $s->sorter] = $j;
            $max_ncol = max($max_ncol, $row->ncol);
            if ($s->incomplete) {
                $u = $Me->user_linkpart($s);
                $incomplete[] = '<a href="' . hoturl("pset", array("pset" => $pset->urlkey, "u" => $u, "sort" => req("sort"))) . '">' . htmlspecialchars($u) . '</a>';
            }
        }
    }
    if (count($incomplete)) {
        echo '<div id="incomplete_pset', $pset->id, '" style="display:none" class="merror">', '<strong>', htmlspecialchars($pset->title), '</strong>: ', 'Your grading is incomplete. Missing grades: ', join(", ", $incomplete), '</div>', '<script>jQuery("#incomplete_pset', $pset->id, '").remove().show().appendTo("#incomplete_notices")</script>';
    }
    if ($checkbox) {
        echo Ht::form_div(hoturl_post("index", array("pset" => $pset->urlkey, "save" => 1)));
    }
    $sort_key = $anonymous ? "anon_username" : "username";
    usort($jx, function ($a, $b) use($sort_key) {
        if (get($a, "boring") != get($b, "boring")) {
            return get($a, "boring") ? 1 : -1;
        }
        return strcmp($a[$sort_key], $b[$sort_key]);
    });
    echo '<table class="s61', $anonymous ? " s61anonymous" : "", '" id="pa-pset' . $pset->id . '"></table>';
    $jd = ["checkbox" => $checkbox, "anonymous" => $anonymous, "grade_keys" => array_keys($pset->grades), "gitless" => $pset->gitless, "gitless_grades" => $pset->gitless_grades, "urlpattern" => hoturl("pset", ["pset" => $pset->urlkey, "u" => "@", "sort" => req("sort")])];
    $i = $nintotal = $last_in_total = 0;
    foreach ($pset->grades as $ge) {
        if (!$ge->no_total) {
            ++$nintotal;
            $last_in_total = $ge->name;
        }
        ++$i;
    }
    if ($nintotal > 1) {
        $jd["need_total"] = true;
    } else {
        if ($nintotal == 1) {
            $jd["total_key"] = $last_in_total;
        }
    }
    echo Ht::unstash(), '<script>pa_render_pset_table(', $pset->id, ',', json_encode($jd), ',', json_encode(array_values($jx)), ')</script>';
    if ($Me->privChair && !$pset->gitless_grades) {
        echo "<div class='g'></div>";
//.........这里部分代码省略.........
开发者ID:kohler,项目名称:peteramati,代码行数:101,代码来源:home.php

示例13: Ldap

}
*/
$sql = "SELECT rowid";
$sql .= " FROM " . MAIN_DB_PREFIX . "socpeople";
$resql = $db->query($sql);
if ($resql) {
    $num = $db->num_rows($resql);
    $i = 0;
    $ldap = new Ldap();
    $ldap->connect_bind();
    while ($i < $num) {
        $ldap->error = "";
        $obj = $db->fetch_object($resql);
        $contact = new Contact($db);
        $contact->id = $obj->rowid;
        $contact->fetch($contact->id);
        print $langs->trans("UpdateContact") . " rowid=" . $contact->id . " " . $contact->getFullName($langs);
        $oldobject = $contact;
        $oldinfo = $oldobject->_load_ldap_info();
        $olddn = $oldobject->_load_ldap_dn($oldinfo);
        $info = $contact->_load_ldap_info();
        $dn = $contact->_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) {
            print " - " . $langs->trans("OK");
        } else {
            $error++;
            print " - " . $langs->trans("KO") . ' - ' . $ldap->error;
        }
开发者ID:Albertopf,项目名称:prueba,代码行数:31,代码来源:sync_contacts_dolibarr2ldap.php

示例14: user_prev_next

function user_prev_next($user, $pset)
{
    global $Conf;
    $result = $Conf->qe("select c.contactId, c.firstName, c.lastName, c.email,\n\tc.huid, c.anon_username, c.github_username, c.seascode_username, c.extension, group_concat(pl.link) pcid\n\tfrom ContactInfo c\n\tleft join ContactLink pl on (pl.cid=c.contactId and pl.type=" . LINK_PARTNER . " and pl.pset={$pset->id})\n\twhere (c.roles&" . Contact::ROLE_PCLIKE . ")=0 and not c.dropped\n\tgroup by c.contactId");
    $sort = req("sort");
    $students = array();
    while ($result && ($s = Contact::fetch($result))) {
        $s->set_anonymous($user->is_anonymous);
        Contact::set_sorter($s, $sort);
        $students[$s->contactId] = $s;
    }
    uasort($students, "Contact::compare");
    $links = array(null, null);
    $pos = 0;
    $uid = is_object($user) ? $user->contactId : $user;
    // mark user's partners as visited
    if (($s = get($students, $uid)) && $s->pcid) {
        foreach (explode(",", $s->pcid) as $pcid) {
            if ($ss = get($students, $pcid)) {
                $ss->visited = true;
            }
        }
    }
    foreach ($students as $s) {
        if ($s->contactId == $uid) {
            $pos = 1;
        } else {
            if (!get($s, "visited")) {
                $links[$pos] = $s;
                if ($pos) {
                    break;
                }
                $s->visited = true;
                if ($s->pcid) {
                    foreach (explode(",", $s->pcid) as $pcid) {
                        if ($ss = get($students, $pcid)) {
                            $ss->visited = true;
                        }
                    }
                }
            }
        }
    }
    if ($pos == 0) {
        $links[0] = null;
    }
    return $links;
}
开发者ID:kohler,项目名称:peteramati,代码行数:48,代码来源:pset.php

示例15: Societe

            print '</td></tr>';

            // Company / Contact
            if (! empty($conf->societe->enabled))
            {
                print '<tr><td width="25%">'.$langs->trans("LinkToCompanyContact").'</td>';
                print '<td>';
                if ($object->societe_id > 0)
                {
                    $societe = new Societe($db);
                    $societe->fetch($object->societe_id);
                    print $societe->getNomUrl(1,'');
                    if ($object->contact_id)
                    {
                        $contact = new Contact($db);
                        $contact->fetch($object->contact_id);
                        print ' / <a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$object->contact_id.'">'.img_object($langs->trans("ShowContact"),'contact').' '.dol_trunc($contact->getFullName($langs),32).'</a>';
                    }
                }
                else
                {
                    print $langs->trans("ThisUserIsNot");
                }
                print ' ('.$langs->trans("UseTypeFieldToChange").')';
                print '</td>';
                print "</tr>\n";
            }

            // Module Adherent
            if (! empty($conf->adherent->enabled))
            {
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:31,代码来源:card.php


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