本文整理匯總了PHP中Flyspray::array_find方法的典型用法代碼示例。如果您正苦於以下問題:PHP Flyspray::array_find方法的具體用法?PHP Flyspray::array_find怎麽用?PHP Flyspray::array_find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Flyspray
的用法示例。
在下文中一共展示了Flyspray::array_find方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: only
if ($move == 1) {
$catarray = $toproject->listCategories();
} else {
$catarray = $proj->listCategories();
}
if (isset($_POST['product_category']) && (!is_numeric(Post::val('product_category')) || false === Flyspray::array_find('category_id', Post::val('product_category'), $catarray))) {
$errors['invalidcategory'] = 1;
}
# FIXME what if we move to different project, but os_id is defined for the old project only (not global)?
# FIXME what if we move to different project and operating_system selection is deactivated/not shown in edit task page?
if ($move == 1) {
$osarray = $toproject->listOs();
} else {
$osarray = $proj->listOs();
}
if (isset($_POST['operating_system']) && (!is_numeric(Post::val('operating_system')) || $_POST['operating_system'] !== '0' && false === Flyspray::array_find('os_id', Post::val('operating_system'), $osarray))) {
$errors['invalidos'] = 1;
}
if ($due_date = Post::val('due_date', 0)) {
$due_date = Flyspray::strtotime(Post::val('due_date'));
}
$estimated_effort = 0;
if (($estimated_effort = effort::EditStringToSeconds(Post::val('estimated_effort'), $proj->prefs['hours_per_manday'], $proj->prefs['estimated_effort_format'])) === FALSE) {
$errors['invalideffort'] = 1;
}
$time = time();
$result = $db->Query('SELECT * from {tasks} WHERE task_id = ?', array($task['task_id']));
$defaults = $db->fetchRow($result);
if (!Post::has('due_date')) {
$due_date = $defaults['due_date'];
}
示例2: listallGroups
/**
* Returns a list of all groups, sorted by project
* @param integer $user_id restrict to groups the user is member of
* @access public static
* @return array
* @version 1.0
*/
function listallGroups($user_id = null)
{
global $db, $fs;
$group_list = array(L('global') => null);
$params = array();
$query = 'SELECT g.group_id, group_name, group_desc, g.project_id, project_title
FROM {groups} g
LEFT JOIN {projects} p ON p.project_id = g.project_id';
// Limit to groups a specific user is in
if (!is_null($user_id)) {
$query .= ' LEFT JOIN {users_in_groups} uig ON uig.group_id = g.group_id
WHERE uig.user_id = ? ';
$params[] = $user_id;
}
$sql = $db->getAll($query, null, $params);
foreach ($sql as $row) {
// make sure that the user only sees projects he is allowed to
if ($row['project_id'] != '0' && Flyspray::array_find('project_id', $row['project_id'], $fs->projects) === false) {
continue;
}
$group_list[$row['project_title']][] = $row;
}
$group_list[L('global')] = $group_list[''];
unset($group_list['']);
return $group_list;
}