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


PHP Contact::newContact方法代码示例

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


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

示例1: PageContactEdit

 /**
  * Constructor: ONLY TO BE CALLED like this: Page::newPage(classname,$id,$add) factory method!! 
  * 
  * @param $idOrContact integer|Contact the id of the contact, or the contact that is to be edited
  * @param $add boolean whether the contact is to be added or not (cannot be detected through {@link $id}, because a contact can be passed if an error occurs to preserve already inserted information)
  * @param $xsltProcessing boolean allows to deactivate XSLT processing if FALSE. default: TRUE
  * @global Options admin options
  */
 function PageContactEdit($idOrContact, $add = false, $enableXSLTProcessing = TRUE)
 {
     global $options;
     $this->counters = array();
     $this->add = $add;
     $this->enableXSLTProcessing = $enableXSLTProcessing;
     if ($idOrContact === null) {
         $this->contact = Contact::newContact();
         $this->add = TRUE;
     } elseif (is_numeric($idOrContact)) {
         $this->contact = Contact::newContact($idOrContact);
     } else {
         $this->contact =& $idOrContact;
     }
     // MANDATORY SECURITY CHECK IN CONSTRUCTOR OF EACH PAGE
     $rightsManager = RightsManager::getSingleton();
     if ($add) {
         if (!$rightsManager->currentUserIsAllowedTo('create')) {
             ErrorHandler::getSingleton()->standardError('PERMISSION_DENIED', basename($_SERVER['SCRIPT_NAME']));
         }
         $this->Page('Add new entry');
     } else {
         if (!$rightsManager->currentUserIsAllowedTo('edit', $this->contact)) {
             ErrorHandler::getSingleton()->standardError('PERMISSION_DENIED', basename($_SERVER['SCRIPT_NAME']));
         }
         $this->Page($this->contact->contact['firstname'] . ' ' . $this->contact->contact['lastname']);
     }
     $this->menu = new Navigation('edit-menu');
     // disable save when XSLT will be processed. XSLT files MUST provide their own save button.
     if (!($this->enableXSLTProcessing && !empty($this->contact->contact['xsltDisplayType']))) {
         $this->menu->addEntry('save', 'save', 'javascript:saveEntry();');
     }
     if (isset($this->contact->contact['id'])) {
         $this->menu->addEntry('cancel', 'cancel', '?id=' . $this->contact->contact['id']);
     } else {
         $this->menu->addEntry('cancel', 'cancel', Navigation::previousPageUrl());
     }
     if (!$this->add) {
         $rightsManager = RightsManager::getSingleton();
         if ($rightsManager->mayDeleteContact($this->contact)) {
             $this->menu->addEntry('delete', 'delete', 'javascript:deleteEntry(' . $this->contact->contact['id'] . ');');
             if ($_SESSION['user']->isAtLeast('admin') && $options->getOption('deleteTrashMode')) {
                 $this->menu->addEntry('trash', 'trash', '?mode=trash&id=' . $this->contact->contact['id']);
             }
         }
     }
     if ($_SESSION['user']->isAtLeast('admin')) {
         // no putting on changed list
         $this->menu->addEntry('adminsave', '[adminsave]', 'javascript:adminsaveEntry();');
     }
 }
开发者ID:netiul,项目名称:cgkutrechtwest-gadgets,代码行数:59,代码来源:PageContactEdit.class.php

示例2: PageContact

 /**
  * Constructor
  * 
  * init superclass, create navigation, init variables {@link $contact}, {@link $cardMenu}, {@link $pluginMenu} and {@link $image}
  * if passed value is an integer, the contact with this id is loaded, else it is considered as the contact class itself
  * @param integer|Contact $idOrContact contact, contact id when adding
  * @param boolean $enableXsltProcessing Allows to disable XSLT processing (Default: TRUE)
  * @global Options used to determine options
  * @global PluginManager used to generate plugin menu
  */
 function PageContact($idOrContact, $enableXsltProcessing = TRUE)
 {
     global $options, $pluginManager, $errorHandler;
     $this->noXSLT = !$enableXsltProcessing;
     if (is_numeric($idOrContact)) {
         $this->contact = Contact::newContact($idOrContact);
     } else {
         $this->contact =& $idOrContact;
     }
     // MANDATORY SECURITY CHECK IN CONSTRUCTOR OF EACH PAGE
     $rightsManager = RightsManager::getSingleton();
     if (!$rightsManager->currentUserIsAllowedTo('view', $this->contact)) {
         $errorHandler->standardError('PERMISSION_DENIED', basename($_SERVER['SCRIPT_NAME']));
     }
     $this->Page($this->contact->contact['firstname'] . ' ' . $this->contact->contact['lastname']);
 }
开发者ID:netiul,项目名称:cgkutrechtwest-gadgets,代码行数:26,代码来源:PageContact.class.php

示例3: PageProjectContactEdit

 /**
  * Constructor: ONLY TO BE CALLED like this: Page::newPage(classname,$id,$add) factory method!! 
  * 
  * @param $idOrContact integer|Contact the id of the contact, or the contact that is to be edited
  * @param $add boolean whether the contact is to be added or not (cannot be detected through {@link $id}, because a contact can be passed if an error occurs to preserve already inserted information)
  * @global Options admin options
  */
 function PageProjectContactEdit($idOrContact, $add = false)
 {
     global $options;
     $this->counters = array();
     $this->add = $add;
     if ($idOrContact === null) {
         $this->contact = Contact::newContact();
         $this->add = TRUE;
     } elseif (is_numeric($idOrContact)) {
         $this->contact = Contact::newContact($idOrContact);
     } else {
         $this->contact =& $idOrContact;
     }
     if ($add) {
         $this->Page('Add new entry');
     } else {
         $this->Page('Edit entry for <span>' . $this->contact->contact['firstname'] . ' ' . $this->contact->contact['lastname'] . '</span>');
     }
     $this->menu = new Navigation('edit-menu');
     $this->menu->addEntry('save', 'save', 'javascript:saveEntry();');
     if (isset($this->contact->contact['id'])) {
         $this->menu->addEntry('cancel', 'cancel', '?id=' . $this->contact->contact['id']);
     } else {
         $this->menu->addEntry('cancel', 'cancel', Navigation::mainPageUrl());
     }
     if (!$this->add) {
         $rightsManager = RightsManager::getSingleton();
         if ($rightsManager->mayDeleteContact($this->contact)) {
             $this->menu->addEntry('delete', 'delete', 'javascript:deleteEntry(' . $this->contact->contact['id'] . ');');
             if ($_SESSION['user']->isAtLeast('admin') && $options->getOption('deleteTrashMode')) {
                 $this->menu->addEntry('trash', 'trash', '?mode=trash&amp;id=' . $this->contact->contact['id']);
             }
         }
     }
     if ($_SESSION['user']->isAtLeast('admin')) {
         // no putting on changed list
         $this->menu->addEntry('adminsave', 'adminsave', 'javascript:adminsaveEntry();');
     }
 }
开发者ID:netiul,项目名称:cgkutrechtwest-gadgets,代码行数:46,代码来源:PageProjectContactEdit.class.php

示例4: innerCreate

 /**
  * create the content of recently changed
  * @return string html-content
  * @global Options determine how many days after change the contact should still be shown
  * @param boolean $compact whether list should be displayed with imported link and user who changed contact
  */
 function innerCreate()
 {
     global $db, $CONFIG_DB_PREFIX, $CONFIG_ADMIN_REQUEST_INTERFACE, $CONFIG_ADMIN_REQUEST_BREAKS;
     $db->query("SELECT * FROM `{$CONFIG_DB_PREFIX}AdministrativeRequests` AS request WHERE dateProcessed IS NULL OR ( DATE_ADD(dateProcessed, INTERVAL 14 DAY) >= NOW() )", 'AdministrativeRequest');
     //. TABLE_PROPERTIES . " AS prop
     //WHERE contact.id=prop.id AND prop.label=" . $db->escape($this->featureLabel) . '
     //ORDER BY prop.value ' . ($this->ascending ? 'ASC' : 'DESC') . ($this->limit > 0 ? ' LIMIT '.$this->limit : ''));
     $fields = array('contactId', 'dateAdded', 'requesterId', 'dateProcessed', 'whoProcessedId');
     foreach ($CONFIG_ADMIN_REQUEST_INTERFACE as $k => $v) {
         if (substr($k, 0, 4) != 'html' && $k != 'submit') {
             // not for DB!
             $fields[] = $k;
         }
     }
     $data = array();
     $i = 0;
     while ($c = $db->next('AdministrativeRequest')) {
         $data[$i] = $c;
         if (empty($data[$i]['dateProcessed'])) {
             $id = $data[$i]['requestId'];
             $data[$i]['dateProcessed'] = "<a href='todo?mode=done&id={$id}'>set done</a>";
         }
         if (!empty($data[$i]['whoProcessedId'])) {
             $contact = Contact::newContact($data[$i]['whoProcessedId']);
             $data[$i]['whoProcessedId'] = '<a href="../contact/contact.php?id=' . $contact->contact['id'] . '">' . $contact->contact['lastname'] . (!empty($contact->contact['firstname']) ? ', ' . $contact->contact['firstname'] : '') . '</a>';
         }
         $contact = Contact::newContact($data[$i]['contactId']);
         $data[$i]['contactId'] = '<a href="../contact/contact.php?id=' . $contact->contact['id'] . '">' . $contact->contact['lastname'] . (!empty($contact->contact['firstname']) ? ', ' . $contact->contact['firstname'] : '') . '</a>';
         $contact = Contact::newContact($data[$i]['requesterId']);
         $data[$i]['requesterId'] = '<a href="../contact/contact.php?id=' . $contact->contact['id'] . '">' . $contact->contact['lastname'] . (!empty($contact->contact['firstname']) ? ', ' . $contact->contact['firstname'] : '') . '</a>';
         $i++;
     }
     $cont = '<style>.parr-list { margin: 20px auto 20px auto; width: 90%; } .parr-list th { border: 1px solid; } .parr-list td { border: 1px solid  #AAA; } td.parr-list-tdblank { border: none; } </style>';
     $tGen = new TableGenerator('parr-list', $fields, $CONFIG_ADMIN_REQUEST_BREAKS);
     $cont .= $tGen->generateTable($data, $fields);
     $cont .= '<div><a href="' . Navigation::previousPageUrl() . '">return</a></div><br>';
     return $cont;
 }
开发者ID:netiul,项目名称:cgkutrechtwest-gadgets,代码行数:44,代码来源:PageAdministrativeRequestsReport.class.php

示例5: chdir

 *  Map PLUGIN for THE ADDRESS BOOK
 *************************************************************
* @package plugins
* @author Thomas Katzlberger
*/
chdir('../../');
require_once 'lib/init.php';
require_once 'Contact.class.php';
require_once 'DB.class.php';
require_once 'StringHelper.class.php';
require_once 'ErrorHandler.class.php';
if (isset($_GET['id'])) {
    $address_id = StringHelper::cleanGPC($_GET['id']);
}
if (isset($_GET['cid'])) {
    $contact = Contact::newContact(intval(StringHelper::cleanGPC($_GET['cid'])));
}
// use for the google-bubble?
// search correct address in value group ... not very efficient
$adds = $contact->getValueGroup('addresses');
foreach ($adds as $a) {
    if ($a['refid'] == $address_id) {
        $add =& $a;
        break;
    }
}
if (!isset($add)) {
    $errorHandler->error('argVal', 'The address with id=' . $address_id . ' does not exist');
}
$errorMessage = 'Unable to map this address. The address may not be included in any geocoder currently available here, or it is simply misspelled. Sorry!';
// Cache Geocode ... currently not available, needs API key
开发者ID:netiul,项目名称:cgkutrechtwest-gadgets,代码行数:31,代码来源:Map.display.php

示例6: ob_start

 *  contact/media.php
 *  Returns a media of a contact (currently only images).
 *
 *************************************************************/
// If a whitespace is output from header files
ob_start();
chdir('..');
require_once 'lib/init.php';
require_once 'Contact.class.php';
require_once 'RightsManager.class.php';
require_once 'ErrorHandler.class.php';
// kill whitespaces
ob_end_clean();
$rightsManager = RightsManager::getSingleton();
if (!isset($_GET['id'])) {
    $_GET['id'] = '';
}
$contact = Contact::newContact(intval($_GET['id']));
if (!$rightsManager->mayViewContact($contact)) {
    $errorHandler->standardError('PERMISSION_DENIED', basename($_SERVER['SCRIPT_NAME']));
}
$length = 0;
$mimeType = '';
$media =& $contact->getMedia('pictureData', $mimeType, $length);
if ($media == null) {
    $errorHandler->standardError('PERMISSION_DENIED', basename($_SERVER['SCRIPT_NAME']));
}
header('Content-Type: ' . $mimeType);
header('Content-Length: ' . $length);
echo $media;
exit;
开发者ID:netiul,项目名称:cgkutrechtwest-gadgets,代码行数:31,代码来源:media.php

示例7: chdir

 *
 *************************************************************/
chdir('../../');
require_once 'lib/init.php';
require_once 'ContactImportExport.class.php';
// logged in?
$rightsManager = RightsManager::getSingleton();
if (!isset($_GET['mode'])) {
    $_GET['mode'] = 'default';
}
if (!isset($_GET['id'])) {
    // invalid
    $errorHandler->error('invArg', 'Contact id missing.', basename($_SERVER['SCRIPT_NAME']));
}
// export whom?
$contact = Contact::newContact($_GET['id']);
// allowed to view?
if (!$rightsManager->mayViewContact($contact)) {
    $errorHandler->standardError('PERMISSION_DENIED', basename($_SERVER['SCRIPT_NAME']));
}
// ** EXPORT FORMATS **
switch ($_GET['format']) {
    // How about this? http://www.oasis-open.org/committees/ciq/ciq.html#6
    default:
        /* SEE: http://vcardmaker.wackomenace.co.uk/, http://tools.ietf.org/html/rfc2426
         * There is still lots of info missing: Occupation -> TITLE:, Company -> ?, Department
         * Please post improvements to: http://sourceforge.net/tracker/?group_id=172286&atid=861164 as attachment!!
         * Or to the developer forums at: http://sourceforge.net/forum/forum.php?forum_id=590644
         */
    /* SEE: http://vcardmaker.wackomenace.co.uk/, http://tools.ietf.org/html/rfc2426
     * There is still lots of info missing: Occupation -> TITLE:, Company -> ?, Department
开发者ID:netiul,项目名称:cgkutrechtwest-gadgets,代码行数:31,代码来源:export.php

示例8: createCreateUser

 /**
  * create form to create a new user (only used by admin)
  * @global ErrorHandler used to catch errors that occured
  * @return string html-content
  */
 function createCreateUser()
 {
     global $errorHandler;
     $cont = '<div class="login-form">';
     $cont .= '<img class="tab-title" src="../images/banner.png" />';
     switch ($this->flag) {
         case 'ok':
             $cont .= '<div class="login-message">Successfully added user</div>';
             break;
         case 'error':
             ($err = $errorHandler->getLastError('register')) || ($err = $errorHandler->getLastError('login'));
             $cont .= '<div class="login-error">' . $err['cause'] . '</div>';
             break;
         default:
             if (!isset($_GET['id'])) {
                 $_GET['id'] = '';
             }
             $contact = Contact::newContact(intval($_GET['id']));
             $mails = $contact->getValueGroup('email');
             if ($contact->isUser()) {
                 $cont .= '<div class="login-error">This contact is already a user</div>';
                 break;
             }
             if (count($mails) <= 0) {
                 $cont .= '<div class="login-error">This contact has no email-address</div>';
                 break;
             }
             $cont .= '<div class="login-message">Please choose the email address to use and enter a password.</div>';
             $cont .= '<form action="../user/register.php?mode=cuser&amp;id=' . $contact->contact['id'] . '" method="post">';
             $cont .= '<div><label class="register-label" for="email">email</label></div>';
             $cont .= '<div><select name="email" id="email">';
             foreach ($mails as $m) {
                 $cont .= '<option>' . $m['value'] . '</option>';
             }
             $cont .= '</select></div>';
             $cont .= '<br/><div><label class="register-label" for="password1">password</label>';
             $cont .= '<input class="register-input" type="password" name="password1" id="password1" /></div>';
             $cont .= '<br/><div><label class="register-label" for="password2">repeat</label>';
             $cont .= '<input class="register-input" type="password" name="password2" id="password2" /></div>';
             $cont .= '<br/><div><input class="register-input" type="submit" value="ok" /></div>';
             $cont .= '</form>';
     }
     $cont .= '<br/><div><a href="../contact/contact.php?id=' . $_GET['id'] . '">return</a></div>';
     $cont .= '</div>';
     return $cont;
 }
开发者ID:netiul,项目名称:cgkutrechtwest-gadgets,代码行数:51,代码来源:PageRegister.class.php

示例9: vCardImport


//.........这里部分代码省略.........
         $data['blank'][$i]['value'] = $x;
         $data['blank'][$i++]['visibility'] = 'visible';
     }
     $x = $vc->getTel('PAGER');
     $x = ContactImportExport::vCardUnEscape($x);
     if (!empty($x)) {
         $data['blank'][$i]['type'] = 'phone';
         $data['blank'][$i]['label'] = 'pager';
         $data['blank'][$i]['value'] = $x;
         $data['blank'][$i++]['visibility'] = 'visible';
     }
     $x = $vc->getTel('VIDEO');
     $x = ContactImportExport::vCardUnEscape($x);
     if (!empty($x)) {
         $data['blank'][$i]['type'] = 'phone';
         $data['blank'][$i]['label'] = 'video';
         $data['blank'][$i]['value'] = $x;
         $data['blank'][$i++]['visibility'] = 'visible';
     }
     // delivers only one result!!
     list($key, $x) = each($vc->getEmail('INTERNET', 'OR'));
     $x = ContactImportExport::vCardUnEscape($x);
     if (!empty($x)) {
         $data['blank'][$i]['type'] = 'email';
         $data['blank'][$i]['label'] = '';
         $data['blank'][$i]['value'] = $x;
         $data['blank'][$i++]['visibility'] = 'visible';
     }
     // 7. ORGANIZATIONAL TYPES methods:
     $x = $vc->getTitle();
     $x = ContactImportExport::vCardUnEscape($x);
     if (!empty($x)) {
         $data['blank'][$i]['type'] = 'other';
         $data['blank'][$i]['label'] = 'Job Title';
         $data['blank'][$i]['value'] = $vc->getTitle();
         $data['blank'][$i++]['visibility'] = 'visible';
     }
     $x = $vc->getRole();
     $x = ContactImportExport::vCardUnEscape($x);
     if (!empty($x)) {
         $data['blank'][$i]['type'] = 'other';
         $data['blank'][$i]['label'] = 'Role';
         $data['blank'][$i]['value'] = $vc->getRole();
         $data['blank'][$i++]['visibility'] = 'visible';
     }
     $x = $vc->getOrg();
     $x = ContactImportExport::vCardUnEscape($x);
     if (!empty($x)) {
         $data['blank'][$i]['type'] = 'other';
         $data['blank'][$i]['label'] = 'Organization';
         $data['blank'][$i]['value'] = $x;
         $data['blank'][$i++]['visibility'] = 'visible';
     }
     // cannot go into OU of SSL_CA bacause may not be admin importer here
     $x = $vc->getOrg('ORGUNIT');
     $x = ContactImportExport::vCardUnEscape($x);
     if (!empty($x)) {
         $data['blank'][$i]['type'] = 'other';
         $data['blank'][$i]['label'] = 'Organizational Unit';
         $data['blank'][$i]['value'] = $x;
         $data['blank'][$i++]['visibility'] = 'visible';
     }
     // what is ORGUNITS ???
     // 8. EXPLANATORY TYPES methods:
     $x = $vc->getUrl('WORK');
     $y = ContactImportExport::vCardUnEscape($x);
     if (!empty($x)) {
         $data['blank'][$i]['type'] = 'www';
         $data['blank'][$i]['label'] = 'Work';
         $data['blank'][$i]['value'] = $x;
         $data['blank'][$i++]['visibility'] = 'visible';
     }
     $x = $vc->getUrl('HOME');
     $x = ContactImportExport::vCardUnEscape($x);
     if (!empty($x)) {
         $data['blank'][$i]['type'] = 'www';
         $data['blank'][$i]['label'] = 'Home';
         $data['blank'][$i]['value'] = $x;
         $data['blank'][$i++]['visibility'] = 'visible';
     }
     //$data['contact']['notes'] = $vc->getNote();
     // Attach picture ...
     $url = $vc->getBinary('PHOTO', 'URL');
     if (!empty($url)) {
         $data['contact']['pictureURL'] = $url;
     }
     //import_change_encoding(&$data);
     // save it to the DB
     $contact = Contact::newContact();
     // curretly this must go before save! When we have the Media class it may need to go after save (?)
     $pic = $vc->getBinary('PHOTO', 'JPEG');
     if (!empty($pic) && $options->getOption('picAllowUpload')) {
         $binaryPicture = base64_decode($pic);
         //  future:  $contact->setMedia('pictureData');
         $contact->setMedia('pictureData', 'image/jpeg', $binaryPicture);
     }
     $contact->saveContactFromArray($data);
     $errorHandler->success('Imported: ' . $data['contact']['firstname'] . ' ' . $data['contact']['lastname'], basename($_SERVER['SCRIPT_NAME']));
     return $contact;
 }
开发者ID:netiul,项目名称:cgkutrechtwest-gadgets,代码行数:101,代码来源:ContactImportExport.class.php

示例10: processQueryResult

 /**
  * creates a contact from the passed data
  * @param array $r data from database
  */
 function processQueryResult($r)
 {
     $this->contacts[] = Contact::newContact($r);
 }
开发者ID:netiul,项目名称:cgkutrechtwest-gadgets,代码行数:8,代码来源:ContactList.class.php


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