本文整理汇总了PHP中ExtraFieldValue::get_all方法的典型用法代码示例。如果您正苦于以下问题:PHP ExtraFieldValue::get_all方法的具体用法?PHP ExtraFieldValue::get_all怎么用?PHP ExtraFieldValue::get_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExtraFieldValue
的用法示例。
在下文中一共展示了ExtraFieldValue::get_all方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
// Set selected to current session
$sessionList[$sessionId]['selected'] = 'selected="selected"';
$studentList['session']['id'] = $sessionId;
// Assign variables
$fieldsArray = array('description', 'target', 'mode', 'publication_end_date', 'recommended_number_of_participants', 'vacancies');
$sessionArray = api_get_session_info($sessionId);
$extraSession = new ExtraFieldValue('session');
$extraField = new ExtraField('session');
// Get session fields
$fieldList = $extraField->get_all(array('variable IN ( ?, ?, ?, ?, ?, ?)' => $fieldsArray));
// Index session fields
foreach ($fieldList as $field) {
$fields[$field['id']] = $field['variable'];
}
$params = array(' item_id = ? ' => $sessionId);
$sessionFieldValueList = $extraSession->get_all(array('where' => $params));
foreach ($sessionFieldValueList as $sessionFieldValue) {
// Check if session field value is set in session field list
if (isset($fields[$sessionFieldValue['field_id']])) {
$var = $fields[$sessionFieldValue['field_id']];
$val = $sessionFieldValue['value'];
// Assign session field value to session
$sessionArray[$var] = $val;
}
}
$adminsArray = UserManager::get_all_administrators();
$data['action'] = 'confirm';
$data['sessionId'] = $sessionId;
$data['currentUserId'] = api_get_user_id();
$isWesternNameOrder = api_is_western_name_order();
foreach ($studentList['students'] as &$student) {
示例2: array
// Prepare data
// Get session data
// Assign variables
$fieldsArray = array('description', 'target', 'mode', 'publication_end_date', 'recommended_number_of_participants');
$sessionArray = api_get_session_info($data['sessionId']);
$extraSession = new ExtraFieldValue('session');
$extraField = new ExtraField('session');
// Get session fields
$fieldList = $extraField->get_all(array('variable IN ( ?, ?, ?, ?, ?)' => $fieldsArray));
$fields = array();
// Index session fields
foreach ($fieldList as $field) {
$fields[$field['id']] = $field['variable'];
}
$mergedArray = array_merge(array($data['sessionId']), array_keys($fields));
$sessionFieldValueList = $extraSession->get_all(array('item_id = ? field_id IN ( ?, ?, ?, ?, ?, ?, ? )' => $mergedArray));
foreach ($sessionFieldValueList as $sessionFieldValue) {
// Check if session field value is set in session field list
if (isset($fields[$sessionFieldValue['field_id']])) {
$var = $fields[$sessionFieldValue['field_id']];
$val = $sessionFieldValue['value'];
// Assign session field value to session
$sessionArray[$var] = $val;
}
}
// Get student data
$studentArray = api_get_user_info($data['studentUserId']);
$studentArray['picture'] = $studentArray['avatar'];
// Get superior data if exist
$superiorId = UserManager::getStudentBoss($data['studentUserId']);
if (!empty($superiorId)) {
示例3: getFilteredExtraFields
/**
* @param $sessionId
* @param array $extraFieldsToInclude
* @return array
*/
public static function getFilteredExtraFields($sessionId, $extraFieldsToInclude = array())
{
$extraData = array();
$variables = array();
$variablePlaceHolders = array();
foreach ($extraFieldsToInclude as $sessionExtraField) {
$variablePlaceHolders[] = "?";
$variables[] = Database::escape_string($sessionExtraField);
}
$sessionExtraField = new ExtraField('session');
$fieldList = $sessionExtraField->get_all(array("variable IN ( " . implode(", ", $variablePlaceHolders) . " ) " => $variables));
$fields = array();
// Index session fields
foreach ($fieldList as $field) {
$fields[$field['id']] = $field['variable'];
}
// Get session field values
$extra = new ExtraFieldValue('session');
$sessionFieldValueList = $extra->get_all(array("field_id IN ( " . implode(", ", $variablePlaceHolders) . " )" => array_keys($fields)));
foreach ($sessionFieldValueList as $sessionFieldValue) {
// Match session field values to session
if ($sessionFieldValue['item_id'] != $sessionId) {
continue;
}
// Check if session field value is set in session field list
if (!isset($fields[$sessionFieldValue['field_id']])) {
continue;
}
$extrafieldVariable = $fields[$sessionFieldValue['field_id']];
$extrafieldValue = $sessionFieldValue['value'];
$extraData[] = array('variable' => $extrafieldVariable, 'value' => $extrafieldValue);
}
return $extraData;
}
示例4: listAllStudentsInQueueBySession
/**
* Return the list of student, in queue used by admin view
* @param int $sessionId
*
* @return array
*/
public function listAllStudentsInQueueBySession($sessionId)
{
// Filter input variable
$sessionId = intval($sessionId);
// Assign variables
$fieldsArray = array('target', 'publication_end_date', 'mode', 'recommended_number_of_participants', 'vacancies');
$sessionArray = api_get_session_info($sessionId);
$extraSession = new ExtraFieldValue('session');
$extraField = new ExtraField('session');
// Get session fields
$fieldList = $extraField->get_all(array('variable IN ( ?, ?, ?, ?, ?)' => $fieldsArray));
// Index session fields
$fields = array();
foreach ($fieldList as $field) {
$fields[$field['id']] = $field['variable'];
}
$mergedArray = array_merge(array($sessionId), array_keys($fields));
$sessionFieldValueList = $extraSession->get_all(array('item_id = ? field_id IN ( ?, ?, ?, ?, ?, ?, ? )' => $mergedArray));
foreach ($sessionFieldValueList as $sessionFieldValue) {
// Check if session field value is set in session field list
if (isset($fields[$sessionFieldValue['field_id']])) {
$var = $fields[$sessionFieldValue['field_id']];
$val = $sessionFieldValue['value'];
// Assign session field value to session
$sessionArray[$var] = $val;
}
}
$queueTable = Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE);
$userTable = Database::get_main_table(TABLE_MAIN_USER);
$userJoinTable = $queueTable . ' q INNER JOIN ' . $userTable . ' u ON q.user_id = u.user_id';
$where = array('where' => array('q.session_id = ?' => array($sessionId)), 'order' => 'q.status DESC, u.lastname ASC');
$select = 'u.user_id, u.firstname, u.lastname, q.created_at, q.updated_at, q.status, q.id as queue_id';
$students = Database::select($select, $userJoinTable, $where);
foreach ($students as &$student) {
$status = intval($student['status']);
switch ($status) {
case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_NO_QUEUE:
case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_START:
$student['validation'] = '';
break;
case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_DISAPPROVED:
case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_DISAPPROVED:
$student['validation'] = 'No';
break;
case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_APPROVED:
case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED:
$student['validation'] = 'Yes';
break;
default:
error_log(__FILE__ . ' ' . __FUNCTION__ . ' Student status no detected');
}
}
$return = array('session' => $sessionArray, 'students' => $students);
return $return;
}