• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP validate_length函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中validate_length函数的典型用法代码示例。如果您正苦于以下问题:PHP validate_length函数的具体用法?PHP validate_length怎么用?PHP validate_length使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: blogs_news

function blogs_news()
{
    global $db, $enrolled_courses, $system_courses;
    $news = array();
    if ($enrolled_courses == '') {
        return $news;
    }
    $sql = "SELECT G.group_id, G.title, G.modules, T.course_id FROM " . TABLE_PREFIX . "groups G INNER JOIN " . TABLE_PREFIX . "groups_types  T USING (type_id) WHERE T.course_id IN {$enrolled_courses} ORDER BY G.title";
    $result = mysql_query($sql, $db);
    if ($result) {
        if (mysql_num_rows($result) > 0) {
            while ($row = mysql_fetch_assoc($result)) {
                if (strpos($row['modules'], '_standard/blogs') !== FALSE) {
                    // retrieve the last posted date/time from this blog
                    $sql = "SELECT MAX(date) AS date FROM " . TABLE_PREFIX . "blog_posts WHERE owner_type=" . BLOGS_GROUP . " AND owner_id={$row['group_id']}";
                    $date_result = mysql_query($sql, $db);
                    $row2 = mysql_fetch_assoc($date_result);
                    $last_updated = ' - ' . _AT('last_updated', AT_date(_AT('forum_date_format'), $row2['date'], AT_DATE_MYSQL_DATETIME));
                    $link_title = $row['title'];
                    $news[] = array('time' => $row2['date'], 'object' => $row, 'alt' => _AT('blogs'), 'course' => $system_courses[$row['course_id']]['title'], 'thumb' => 'images/home-blogs_sm.png', 'link' => '<a href="bounce.php?course=' . $row['course_id'] . SEP . 'p=' . urlencode('mods/_standard/blogs/view.php?ot=' . BLOGS_GROUP . SEP . 'oid=' . $row['group_id']) . '"' . (strlen($link_title) > SUBLINK_TEXT_LEN ? ' title="' . AT_print($link_title, 'blog_posts.title') . '"' : '') . '>' . AT_print(validate_length($link_title, SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY), 'blog_posts.title') . '</a>');
                }
            }
        }
    }
    return $news;
}
开发者ID:vicentborja,项目名称:ATutor,代码行数:26,代码来源:module_news.php


示例2: blogs_news

function blogs_news()
{
    global $db, $enrolled_courses, $system_courses;
    $news = array();
    if ($enrolled_courses == '') {
        return $news;
    }
    $sql = "SELECT G.group_id, G.title, G.modules, T.course_id FROM %sgroups G INNER JOIN %sgroups_types  T USING (type_id) WHERE T.course_id IN %s ORDER BY G.title";
    $rows_enrolled = queryDB($sql, array(TABLE_PREFIX, TABLE_PREFIX, $enrolled_courses));
    if (count($rows_enrolled) > 0) {
        foreach ($rows_enrolled as $row) {
            if (strpos($row['modules'], '_standard/blogs') !== FALSE) {
                // check for group membership before showing news.
                $sql = "SELECT member_id FROM %sgroups_members WHERE member_id=%d AND group_id= %d";
                $row_group_member = queryDB($sql, array(TABLE_PREFIX, $_SESSION['member_id'], $row['group_id']), TRUE);
                // check for course instructor, show blog news if so
                $sql = "SELECT member_id from %scourses WHERE member_id =%d";
                $row_instructor = queryDB($sql, array(TABLE_PREFIX, $_SESSION['member_id']));
                if (count($row_group_member) > 0 || count($row_instructor) > 0) {
                    // retrieve the last posted date/time from this blog
                    $sql = "SELECT MAX(date) AS date FROM %sblog_posts WHERE owner_type=%d AND owner_id=%d";
                    $row2 = queryDB($sql, array(TABLE_PREFIX, BLOGS_GROUP, $row['group_id']), TRUE);
                    $last_updated = ' - ' . _AT('last_updated', AT_date(_AT('forum_date_format'), $row2['date'], AT_DATE_MYSQL_DATETIME));
                    $link_title = $row['title'];
                    $news[] = array('time' => $row2['date'], 'object' => $row, 'alt' => _AT('blogs'), 'course' => $system_courses[$row['course_id']]['title'], 'thumb' => 'images/home-blogs_sm.png', 'link' => '<a href="bounce.php?course=' . $row['course_id'] . SEP . 'p=' . urlencode('mods/_standard/blogs/view.php?ot=' . BLOGS_GROUP . SEP . 'oid=' . $row['group_id']) . '"' . (strlen($link_title) > SUBLINK_TEXT_LEN ? ' title="' . AT_print($link_title, 'blog_posts.title') . '"' : '') . '>' . AT_print(validate_length($link_title, SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY), 'blog_posts.title') . '</a>');
                }
            }
        }
    }
    return $news;
}
开发者ID:genaromendezl,项目名称:ATutor,代码行数:31,代码来源:module_news.php


示例3: select_categories

function select_categories($categories, $cat_id, $current_cat_id, $exclude, $depth = 0)
{
    if ($cat_id == 0 && is_array($categories[0])) {
        foreach ($categories[0] as $child_cat_id) {
            select_categories($categories, $child_cat_id, $current_cat_id, $exclude);
        }
    } else {
        if ($exclude && $cat_id == $current_cat_id) {
            return;
        }
        echo '<option value="' . $cat_id . '"';
        if ($exclude && is_array($categories[$cat_id]['children']) && in_array($current_cat_id, $categories[$cat_id]['children'])) {
            echo ' selected="selected"';
        } else {
            if (!$exclude && $cat_id == $current_cat_id) {
                echo ' selected="selected"';
            }
        }
        echo '>';
        echo str_repeat("&nbsp;", $depth * 4);
        echo validate_length($categories[$cat_id]['cat_name'], 45, VALIDATE_LENGTH_FOR_DISPLAY) . '</option>';
        if (isset($categories[$cat_id]['children']) && is_array($categories[$cat_id]['children'])) {
            foreach ($categories[$cat_id]['children'] as $child_cat_id) {
                select_categories($categories, $child_cat_id, $current_cat_id, $exclude, $depth + 1);
            }
        }
    }
}
开发者ID:vicentborja,项目名称:ATutor,代码行数:28,代码来源:admin_categories.inc.php


示例4: links_news

function links_news() {
	global $db, $enrolled_courses, $system_courses;
	$news = array();

	if ($enrolled_courses == ''){
		return $news;
	} 

	$sql = "SELECT * FROM ".TABLE_PREFIX."links L INNER JOIN ".TABLE_PREFIX."links_categories C ON C.cat_id = L.cat_id WHERE owner_id IN $enrolled_courses AND L.Approved=1 ORDER BY SubmitDate DESC";
	$result = mysql_query($sql, $db);
	if($result){
		while($row = mysql_fetch_assoc($result)){
			$news[] = array(
							'time'=>$row['SubmitDate'], 
							'object'=>$row, 
							'alt'=>_AT('links'),
							'course'=>$system_courses[$row['owner_id']]['title'],
							'thumb'=>'images/home-links_sm.png', 
							'link'=>'<a href="bounce.php?course='.$row['owner_id'].'&p='.urlencode('mods/_standard/links/index.php?view='.$row['link_id']).'"'.
									(strlen($row['LinkName']) > SUBLINK_TEXT_LEN ? ' title="'.$row['LinkName'].'"' : '') .'>'. 
									validate_length($row['LinkName'], SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY) .'</a>');
		}
	}
	return $news;
}
开发者ID:radiocontrolled,项目名称:ATutor,代码行数:25,代码来源:module_news.php


示例5: forums_news

function forums_news()
{
    require_once AT_INCLUDE_PATH . '../mods/_standard/forums/lib/forums.inc.php';
    global $db, $enrolled_courses, $system_courses;
    $news = array();
    if ($enrolled_courses == '') {
        return $news;
    }
    $sql = 'SELECT E.approved, E.last_cid, C.* FROM ' . TABLE_PREFIX . 'course_enrollment E, ' . TABLE_PREFIX . 'courses C WHERE C.course_id in ' . $enrolled_courses . '  AND E.member_id=' . $_SESSION['member_id'] . ' AND E.course_id=C.course_id ORDER BY C.title';
    $rows_en_courses = queryDB($sql, array());
    if (count($rows_en_courses) > 0) {
        foreach ($rows_en_courses as $row) {
            $all_forums = get_forums($row['course_id']);
            if (is_array($all_forums)) {
                foreach ($all_forums as $forums) {
                    if (is_array($forums)) {
                        foreach ($forums as $forum_obj) {
                            $forum_obj['course_id'] = $row['course_id'];
                            $link_title = $forum_obj['title'];
                            $news[] = array('time' => $forum_obj['last_post'], 'object' => $forum_obj, 'alt' => _AT('forum'), 'thumb' => 'images/pin.png', 'course' => $system_courses[$row['course_id']]['title'], 'link' => '<a href="bounce.php?course=' . $row['course_id'] . SEP . 'pu=' . urlencode('mods/_standard/forums/forum/index.php?fid=' . $forum_obj['forum_id']) . '"' . (strlen($link_title) > SUBLINK_TEXT_LEN ? ' title="' . AT_print($link_title, 'forums.title') . '"' : '') . '>' . AT_print(validate_length($link_title, SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY), 'forums.title') . '</a>');
                        }
                    }
                }
            }
        }
    }
    return $news;
}
开发者ID:genaromendezl,项目名称:ATutor,代码行数:28,代码来源:module_news.php


示例6: file_storage_news

function file_storage_news()
{
    global $enrolled_courses, $system_courses;
    $news = array();
    if ($enrolled_courses == '') {
        return $news;
    }
    // As personal files are listed in any enrolled courses of the student,
    // randomly pick one course for bouce.php
    $end_of_first_course = strpos($enrolled_courses, ",") - 1;
    $any_one_enrolled_course = substr($enrolled_courses, 1, $end_of_first_course ? $end_of_first_course : -1);
    $sql = "(SELECT date, file_id, file_name, owner_id course_id, description \n\t           FROM " . TABLE_PREFIX . "files \n\t          WHERE owner_type = " . WORKSPACE_COURSE . " AND owner_id IN " . $enrolled_courses . ")\n\t        UNION\n\t        (SELECT date, file_id, file_name, " . $any_one_enrolled_course . " course_id, description \n\t           FROM " . TABLE_PREFIX . "files\n\t          WHERE owner_type = " . WORKSPACE_PERSONAL . " AND owner_id = " . $_SESSION['member_id'] . ")\n\t        UNION\n\t        (SELECT f.date, f.file_id, f.file_name, gt.course_id, f.description \n\t           FROM " . TABLE_PREFIX . "files f, " . TABLE_PREFIX . "groups g, " . TABLE_PREFIX . "groups_types gt\n\t          WHERE owner_type = " . WORKSPACE_GROUP . " \n\t            AND f.owner_id = g.group_id \n\t            AND g.type_id = gt.type_id \n\t            AND gt.course_id IN " . $enrolled_courses . "\n\t            AND " . $_SESSION['member_id'] . " in \n\t               (select member_id \n\t                from " . TABLE_PREFIX . "groups_members gm \n\t                where gm.group_id = g.group_id))\n\t         ORDER BY date DESC";
    $rows_files = queryDB($sql, array());
    if (count($rows_files) > 0) {
        foreach ($rows_files as $row) {
            if ($row['description'] != "") {
                $filetext = $row['description'];
            } else {
                $filetext = $row['file_name'];
            }
            $sql = "SELECT course_id, home_links, main_links from %scourses WHERE course_id = %d";
            $row2 = queryDB($sql, array(TABLE_PREFIX, $row['course_id']), TRUE);
            // check if course has file storage enabled
            if (strstr($row2['home_links'], 'file_storage') || strstr($row2['main_links'], 'file_storage')) {
                $news[] = array('time' => $row['date'], 'object' => $row, 'course' => $system_courses[$row['course_id']]['title'], 'alt' => _AT('download'), 'thumb' => 'images/application_get.png', 'link' => '<a href="bounce.php?course=' . $row['course_id'] . SEP . 'p=' . urlencode('mods/_standard/file_storage/index.php?download=1' . SEP . 'files[]=' . $row['file_id']) . '"' . (strlen($filetext) > SUBLINK_TEXT_LEN ? ' title="' . AT_print($filetext, 'input.text') . '"' : '') . '>' . AT_print(validate_length($filetext, SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY), 'input.text') . '</a>');
            }
        }
    }
    return $news;
}
开发者ID:genaromendezl,项目名称:ATutor,代码行数:30,代码来源:module_news.php


示例7: tests_news

function tests_news() {
	global $db, $enrolled_courses, $system_courses;
	$news = array();

	if ($enrolled_courses == ''){
		return $news;
	} 
	$sql = "SELECT T.test_id, T.course_id, T.title, T.start_date as start_date, UNIX_TIMESTAMP(T.start_date) AS sd, UNIX_TIMESTAMP(T.end_date) AS ed 
          FROM ".TABLE_PREFIX."tests T, ".TABLE_PREFIX."tests_questions_assoc Q 
         WHERE Q.test_id=T.test_id 
           AND T.course_id IN $enrolled_courses 
         GROUP BY T.test_id 
         ORDER BY T.start_date DESC";
	$result = mysql_query($sql, $db);
	if($result){
		while($row = mysql_fetch_assoc($result)){
			//show only the visible tests
			if ( ($row['sd'] <= time()) && ($row['ed'] >= time())){
				$news[] = array('time'=>$row['start_date'], 
								'object'=>$row,
								'alt'=>_AT('tests'),
								'course'=>$system_courses[$row['course_id']]['title'],
								'thumb'=>'images/home-tests_sm.png',
								'link'=>'<a href="bounce.php?course='.$row['course_id'].'&p='.urlencode('mods/_standard/tests/test_intro.php?tid='.$row['test_id']).'" '
										.(strlen($row['title']) > SUBLINK_TEXT_LEN ? ' title="'.$row['title'].'"' : '') .'>'
										.validate_length($row['title'], SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY) .'</a> <small>('._AT('start_date').':'.AT_DATE('%F %j, %g:%i',$row['start_date']).')</small>');
			}
		}
	}
	return $news;
}
开发者ID:radiocontrolled,项目名称:ATutor,代码行数:31,代码来源:module_news.php


示例8: links_news

function links_news()
{
    global $enrolled_courses, $system_courses;
    $news = array();
    if ($enrolled_courses == '') {
        return $news;
    }
    $result = queryDB('SELECT * FROM %slinks L INNER JOIN %slinks_categories C ON C.cat_id = L.cat_id WHERE owner_id IN %s AND L.Approved=1 ORDER BY SubmitDate DESC', array(TABLE_PREFIX, TABLE_PREFIX, $enrolled_courses));
    foreach ($result as $row) {
        $news[] = array('time' => $row['SubmitDate'], 'object' => $row, 'alt' => _AT('links'), 'course' => $system_courses[$row['owner_id']]['title'], 'thumb' => 'images/home-links_sm.png', 'link' => '<a href="bounce.php?course=' . $row['owner_id'] . SEP . 'p=' . urlencode('mods/_standard/links/index.php?view=' . $row['link_id']) . '"' . (strlen($row['LinkName']) > SUBLINK_TEXT_LEN ? ' title="' . $row['LinkName'] . '"' : '') . '>' . validate_length($row['LinkName'], SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY) . '</a> <small>');
    }
    return $news;
}
开发者ID:genaromendezl,项目名称:ATutor,代码行数:13,代码来源:module_news.php


示例9: reading_list_news

function reading_list_news()
{
    global $db, $enrolled_courses, $system_courses;
    $news = array();
    $sql = "SELECT * FROM " . TABLE_PREFIX . "reading_list R INNER JOIN " . TABLE_PREFIX . "external_resources E ON E.resource_id = R.resource_id WHERE R.course_id in " . $enrolled_courses . " ORDER BY R.reading_id DESC";
    $result = mysql_query($sql, $db);
    if (@mysql_num_rows($result) > 0) {
        while ($row = mysql_fetch_assoc($result)) {
            $news[] = array('time' => $row['date_end'], 'object' => $row, 'alt' => _AT('reading_list'), 'course' => $system_courses[$row['course_id']]['title'], 'thumb' => 'images/home-reading_list_sm.png', 'link' => '<a href="' . url_rewrite('mods/_standard/reading_list/display_resource.php?id=' . $row['resource_id'], AT_PRETTY_URL_IS_HEADER) . '"' . (strlen($row['title']) > SUBLINK_TEXT_LEN ? ' title="' . $row['title'] . '"' : '') . '>' . validate_length($row['title'], SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY) . '</a>');
        }
    }
    return $news;
}
开发者ID:vicentborja,项目名称:ATutor,代码行数:13,代码来源:module_news.php


示例10: file_storage_news

function file_storage_news() {
	global $db, $enrolled_courses, $system_courses;
	$news = array();

	if ($enrolled_courses == '') {
		return $news;
	}
	
	// As personal files are listed in any enrolled courses of the student,
	// randomly pick one course for bouce.php
	$end_of_first_course = strpos($enrolled_courses, ",") - 1;
	$any_one_enrolled_course = substr($enrolled_courses, 1, $end_of_first_course ? $end_of_first_course : -1);
	
	$sql = "(SELECT date, file_id, file_name, owner_id course_id, description 
	           FROM ".TABLE_PREFIX."files 
	          WHERE owner_type = ".WORKSPACE_COURSE." AND owner_id IN ".$enrolled_courses.")
	        UNION
	        (SELECT date, file_id, file_name, ".$any_one_enrolled_course." course_id, description 
	           FROM ".TABLE_PREFIX."files
	          WHERE owner_type = ".WORKSPACE_PERSONAL." AND owner_id = ".$_SESSION['member_id'].")
	        UNION
	        (SELECT f.date, f.file_id, f.file_name, gt.course_id, f.description 
	           FROM ".TABLE_PREFIX."files f, ".TABLE_PREFIX."groups g, ".TABLE_PREFIX."groups_types gt
	          WHERE owner_type = ".WORKSPACE_GROUP." 
	            AND f.owner_id = g.group_id 
	            AND g.type_id = gt.type_id 
	            AND gt.course_id IN ".$enrolled_courses.")
	         ORDER BY date DESC";
	$result = mysql_query($sql, $db);
	
	if($result){
		while($row = mysql_fetch_assoc($result)){
			if($row['description'] !=""){
				$filetext = $row['description'];
			} else {
				$filetext = $row['file_name'];
			}
			$news[] = array('time'=>$row['date'], 
			      'object'=>$row, 
			      'course'=>$system_courses[$row['course_id']]['title'],
			      'alt'=>_AT('download'),
			      'thumb'=>'images/application_get.png', 
			      'link'=>'<a href="bounce.php?course='.$row['course_id'].SEP.'p='.urlencode('mods/_standard/file_storage/index.php?download=1'.SEP.'files[]='. $row['file_id']).'"'.
		          (strlen($filetext) > SUBLINK_TEXT_LEN ? ' title="'.AT_print($filetext, 'input.text').'"' : '') .'>'. 
		          AT_print(validate_length($filetext, SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY), 'input.text') .'</a>');
		}
	}
	return $news;
}
开发者ID:radiocontrolled,项目名称:ATutor,代码行数:49,代码来源:module_news.php


示例11: reading_list_news

function reading_list_news()
{
    global $enrolled_courses, $system_courses;
    $news = array();
    if (isset($enrolled_courses)) {
        $sql = "SELECT * FROM %sreading_list R INNER JOIN %sexternal_resources E ON E.resource_id = R.resource_id WHERE R.course_id in %s ORDER BY R.reading_id DESC";
        $rows_resources = queryDB($sql, array(TABLE_PREFIX, TABLE_PREFIX, $enrolled_courses));
        if (count($rows_resources) > 0) {
            foreach ($rows_resources as $row) {
                $news[] = array('time' => $row['date_end'], 'object' => $row, 'alt' => _AT('reading_list'), 'course' => $system_courses[$row['course_id']]['title'], 'thumb' => 'images/home-reading_list_sm.png', 'link' => '<a href="bounce.php?course=' . $row['course_id'] . SEP . 'p=mods/_standard/reading_list/display_resource.php?id=' . $row['resource_id'] . '"' . (strlen($row['title']) > SUBLINK_TEXT_LEN ? ' title="' . $row['title'] . '"' : '') . '>' . validate_length($row['title'], SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY) . '</a>');
            }
        }
        return $news;
    }
}
开发者ID:genaromendezl,项目名称:ATutor,代码行数:15,代码来源:module_news.php


示例12: polls_news

function polls_news()
{
    global $enrolled_courses, $system_courses;
    $news = array();
    if ($enrolled_courses == '') {
        return $news;
    }
    $sql = "SELECT * FROM %spolls WHERE course_id IN %s ORDER BY created_date DESC";
    $rows_polls = queryDB($sql, array(TABLE_PREFIX, $enrolled_courses));
    if (count($rows_polls) > 0) {
        foreach ($rows_polls as $row) {
            $news[] = array('time' => $row['created_date'], 'object' => $row, 'alt' => _AT('polls'), 'course' => $system_courses[$row['course_id']]['title'], 'thumb' => 'images/home-polls_sm.png', 'link' => '<a href="bounce.php?course=' . $row['course_id'] . SEP . 'p=' . urlencode('mods/_standard/polls/index.php#' . $row['poll_id']) . '"' . (strlen($row['question']) > SUBLINK_TEXT_LEN ? ' title="' . AT_print($row['question'], 'polls.question') . '"' : '') . '>' . AT_print(validate_length($row['question'], SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY), 'polls.question') . '</a>');
        }
    }
    return $news;
}
开发者ID:genaromendezl,项目名称:ATutor,代码行数:16,代码来源:module_news.php


示例13: polls_news

function polls_news()
{
    global $db, $enrolled_courses, $system_courses;
    $news = array();
    if ($enrolled_courses == '') {
        return $news;
    }
    $sql = 'SELECT * FROM ' . TABLE_PREFIX . 'polls WHERE course_id IN' . $enrolled_courses . ' ORDER BY created_date DESC';
    $result = mysql_query($sql, $db);
    if ($result) {
        while ($row = mysql_fetch_assoc($result)) {
            $news[] = array('time' => $row['created_date'], 'object' => $row, 'alt' => _AT('polls'), 'course' => $system_courses[$row['course_id']]['title'], 'thumb' => 'images/home-polls_sm.png', 'link' => '<a href="bounce.php?course=' . $row['course_id'] . SEP . 'p=' . urlencode('mods/_standard/polls/index.php#' . $row['poll_id']) . '"' . (strlen($row['question']) > SUBLINK_TEXT_LEN ? ' title="' . AT_print($row['question'], 'polls.question') . '"' : '') . '>' . AT_print(validate_length($row['question'], SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY), 'polls.question') . '</a>');
        }
    }
    return $news;
}
开发者ID:vicentborja,项目名称:ATutor,代码行数:16,代码来源:module_news.php


示例14: faq_news

function faq_news()
{
    global $db, $enrolled_courses, $system_courses;
    $news = array();
    if ($enrolled_courses == '') {
        return $news;
    }
    $sql = "SELECT * FROM %sfaq_topics T INNER JOIN %sfaq_entries E ON T.topic_id = E.topic_id WHERE T.course_id IN %s ORDER BY E.revised_date DESC";
    $rows_faqs = queryDB($sql, array(TABLE_PREFIX, TABLE_PREFIX, $enrolled_courses));
    if (count($rows_faqs) > 0) {
        foreach ($rows_faqs as $row) {
            $news[] = array('time' => $row['revised_date'], 'alt' => _AT('faq'), 'object' => $row, 'course' => $system_courses[$row['course_id']]['title'], 'thumb' => 'images/home-faq_sm.png', 'link' => '<a href="bounce.php?course=' . $row['course_id'] . SEP . 'p=' . urlencode('mods/_standard/faq/index.php#' . $row['entry_id']) . '"' . (strlen($row['question']) > SUBLINK_TEXT_LEN ? ' title="' . AT_print($row['question'], 'faqs.question') . '"' : '') . '>' . AT_print(validate_length($row['question'], SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY), 'faqs.question') . '</a>');
        }
    }
    return $news;
}
开发者ID:genaromendezl,项目名称:ATutor,代码行数:16,代码来源:module_news.php


示例15: tests_news

function tests_news()
{
    global $enrolled_courses, $system_courses;
    $news = array();
    if ($enrolled_courses == '') {
        return $news;
    }
    $sql = "SELECT T.test_id, T.course_id, T.title, T.start_date as start_date, UNIX_TIMESTAMP(T.start_date) AS sd, UNIX_TIMESTAMP(T.end_date) AS ed \n          FROM %stests T, %stests_questions_assoc Q \n         WHERE Q.test_id=T.test_id \n           AND T.course_id IN %s \n         GROUP BY T.test_id \n         ORDER BY T.start_date DESC";
    $rows_tests = queryDB($sql, array(TABLE_PREFIX, TABLE_PREFIX, $enrolled_courses));
    if (count($rows_tests) > 0) {
        foreach ($rows_tests as $row) {
            //show only the visible tests
            if ($row['sd'] <= time() && $row['ed'] >= time()) {
                $news[] = array('time' => $row['start_date'], 'object' => $row, 'alt' => _AT('tests'), 'course' => $system_courses[$row['course_id']]['title'], 'thumb' => 'images/home-tests_sm.png', 'link' => '<a href="bounce.php?course=' . $row['course_id'] . SEP . 'p=' . urlencode('mods/_standard/tests/test_intro.php?tid=' . $row['test_id']) . '" ' . (strlen($row['title']) > SUBLINK_TEXT_LEN ? ' title="' . $row['title'] . '"' : '') . '>' . validate_length($row['title'], SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY) . '</a> <small>(' . _AT('start_date') . ':' . AT_DATE('%F %j, %g:%i', $row['start_date']) . ')</small>');
            }
        }
    }
    return $news;
}
开发者ID:genaromendezl,项目名称:ATutor,代码行数:19,代码来源:module_news.php


示例16: get_additions

function get_additions($sql, $sqlParams, $module, $module_name, $group_id)
{
    global $_base_path;
    $record_limit = 3;
    $str = '';
    $rows = queryDB($sql, $sqlParams);
    if (count($rows) > 0) {
        echo "<h4 class = 'page-title'>" . $module->getName() . "</h4>";
        $str .= '<ol id = "tools"><li class = "top-tool">';
        foreach ($rows as $row) {
            switch ($module_name) {
                case _AT('forums'):
                    $str .= '<a href="' . $_base_path . url_rewrite('mods/_standard/forums/forum/view.php?fid=' . $row[forum_id] . SEP . 'pid=' . $row['post_id']) . '" title="' . AT_print($full_subject, 'forums_threads.subject') . '">' . $row['subject'] . '</a></br>';
                    break;
                case _AT('file_storage'):
                    if ($row['description'] != "") {
                        $filetext = $row['description'];
                    } else {
                        $filetext = $row['file_name'];
                    }
                    $str .= '<a href="' . $_base_path . url_rewrite('mods/_standard/file_storage/index.php?download=1' . SEP . 'files[]=' . $row['file_id']) . '"' . (strlen($filetext) > SUBLINK_TEXT_LEN ? ' title="' . AT_print($filetext, 'input.text') . '"' : '') . '>' . AT_print(validate_length($filetext, SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY), 'input.text') . '</a><br/>';
                    break;
                case _AT('blogs'):
                    $link_title = $row['title'];
                    $str .= '<a href="' . $_base_path . url_rewrite('mods/_standard/blogs/post.php?ot=' . BLOGS_GROUP . SEP . 'oid=' . $group_id . SEP . 'id=' . $row['post_id']) . '"' . (strlen($link_title) > SUBLINK_TEXT_LEN ? ' title="' . AT_print($link_title, 'blog_posts.title') . '"' : '') . '>' . AT_print(validate_length($link_title, SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY), 'blog_posts.title') . '</a><br/>';
                    break;
                case _AT('links'):
                    $str .= '<a href="' . $_base_path . url_rewrite('mods/_standard/links/index.php?view=' . $row['link_id']) . '"' . (strlen($row['LinkName']) > SUBLINK_TEXT_LEN ? ' title="' . $row['LinkName'] . '"' : '') . '>' . validate_length($row['LinkName'], SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY) . '</a><br/>';
                    break;
                default:
                    return 0;
                    break;
            }
        }
        $str .= "</li></ol>";
        echo $str;
        return 1;
    } else {
        return 0;
    }
}
开发者ID:genaromendezl,项目名称:ATutor,代码行数:41,代码来源:group_functions.inc.php


示例17: forums_news

function forums_news()
{
    global $db, $enrolled_courses, $system_courses;
    $news = array();
    if ($enrolled_courses == '') {
        return $news;
    }
    $sql = 'SELECT E.approved, E.last_cid, C.* FROM ' . TABLE_PREFIX . 'course_enrollment E, ' . TABLE_PREFIX . 'courses C WHERE C.course_id in ' . $enrolled_courses . '  AND E.member_id=' . $_SESSION['member_id'] . ' AND E.course_id=C.course_id ORDER BY C.title';
    $rows_en_courses = queryDB($sql, array());
    if (count($rows_en_courses) > 0) {
        foreach ($rows_en_courses as $row) {
            $all_forums = get_forums($row['course_id']);
            if (is_array($all_forums)) {
                foreach ($all_forums as $forums) {
                    if (is_array($forums)) {
                        foreach ($forums as $forum_obj) {
                            $latest_post = get_last_post($forum_obj['forum_id']);
                            $forum_obj['course_id'] = $row['course_id'];
                            $link_title = $forum_obj['title'];
                            // attached the first 120 characters of the message to the news item
                            if (strlen($latest_post[0]['body']) > 120) {
                                $last_post = substr($latest_post[0]['body'], 0, 120) . '...';
                            } else {
                                $last_post = $latest_post[0]['body'];
                            }
                            // if this is the only message in a thread, replace parent_id with the post_id
                            if ($latest_post[0]['parent_id'] == 0) {
                                $latest_post[0]['parent_id'] = $latest_post[0]['post_id'];
                            }
                            if ($latest_post[0]['subject'] != '') {
                                $news[] = array('time' => $forum_obj['last_post'], 'object' => $forum_obj, 'alt' => _AT('forum'), 'thumb' => 'images/pin.png', 'course' => $system_courses[$row['course_id']]['title'], 'link' => '<a href="bounce.php?course=' . $row['course_id'] . SEP . 'pu=' . urlencode('mods/_standard/forums/forum/view.php?fid=' . $forum_obj['forum_id'] . SEP . 'pid=' . $latest_post[0]['parent_id']) . '"' . (strlen($link_title) > SUBLINK_TEXT_LEN ? ' title="' . AT_print($link_title, 'forums.title') . '"' : '') . '>' . AT_print(validate_length($link_title, SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY), 'forums.title') . ': ' . $latest_post[0]['subject'] . ' </a> - ' . $last_post);
                            }
                        }
                    }
                }
            }
        }
    }
    return $news;
}
开发者ID:codedust,项目名称:ATutor,代码行数:40,代码来源:module_news.php


示例18: queryDB

<?php

if (!defined('AT_INCLUDE_PATH')) {
    exit;
}
global $contentManager;
$record_limit = 3;
// number of sublinks to display at module home "detail view"
$sql = "SELECT content_id FROM %smember_track WHERE course_id=%d AND member_id=%d ORDER BY last_accessed DESC limit %d";
$rows_tracks = queryDB($sql, array(TABLE_PREFIX, $_SESSION['course_id'], $_SESSION['member_id'], $record_limit));
if (count($rows_tracks) > 0) {
    foreach ($rows_tracks as $row) {
        $link_title = $contentManager->_menu_info[$row['content_id']]['title'];
        $list[] = '<a href="' . url_rewrite('content.php?cid=' . $row['content_id'], AT_PRETTY_URL_IS_HEADER) . '"' . (strlen($link_title) > SUBLINK_TEXT_LEN ? ' title="' . $link_title . '"' : '') . '>' . validate_length($link_title, SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY) . '</a>';
    }
    return $list;
} else {
    return 0;
}
开发者ID:genaromendezl,项目名称:ATutor,代码行数:19,代码来源:sublinks.php


示例19: strlen

    for ($i = 0; $i < $length; $i++) {
        $key .= $charset[mt_rand(0, strlen($charset) - 1)];
    }
    return $key;
}
// Main process
if (isset($_REQUEST['auto_enroll_id'])) {
    $auto_enroll_id = $_REQUEST['auto_enroll_id'];
} else {
    $auto_enroll_id = 0;
}
if (isset($_POST['save']) || isset($_POST['add'])) {
    /* insert or update a category */
    $name = trim($_POST['name']);
    $name = $addslashes($name);
    $name = validate_length($name, 50);
    if (isset($_POST['add']) && !$_POST['add_ids']) {
        $msg->addError('NO_ITEM_SELECTED');
    }
    if (!$msg->containsErrors()) {
        if ($auto_enroll_id == 0) {
            $sql = "INSERT INTO %sauto_enroll(associate_string, name)  VALUES ('%s', '%s')";
            $rows_inserted = queryDB($sql, array(TABLE_PREFIX, get_random_string(6, 10), $name));
            $auto_enroll_id = at_insert_id();
            write_to_log(AT_ADMIN_LOG_INSERT, 'auto_enroll', $rows_inserted, $sqlout);
        } else {
            $sql = "UPDATE %sauto_enroll SET name = '%s' WHERE auto_enroll_id = %d";
            $rows_updated = queryDB($sql, array(TABLE_PREFIX, $name, $auto_enroll_id));
            write_to_log(AT_ADMIN_LOG_UPDATE, 'auto_enroll', $rows_updated, $sqlout);
        }
        if (isset($_POST['add'])) {
开发者ID:genaromendezl,项目名称:ATutor,代码行数:31,代码来源:auto_enroll_edit.php


示例20: _AT

 if ($_POST['question'] == '') {
     $msg->addError(array('EMPTY_FIELDS', _AT('question')));
 }
 if (!$msg->containsErrors()) {
     $choice_new = array();
     // stores the non-blank choices
     $answer_new = array();
     // stores the associated "answer" for the choices
     for ($i = 0; $i < 10; $i++) {
         //$_POST['choice'][$i] = $addslashes(trim($_POST['choice'][$i]));
         $_POST['choice'][$i] = trim($_POST['choice'][$i]);
         /**
          * Db defined it to be 255 length, chop strings off it it's less than that
          * @harris
          */
         $_POST['choice'][$i] = validate_length($_POST['choice'][$i], 255);
         $_POST['answer'][$i] = intval($_POST['answer'][$i]);
         if ($_POST['choice'][$i] == '') {
             /* an empty option can't be correct */
             $_POST['answer'][$i] = 0;
         } else {
             /* filter out empty choices/ remove gaps */
             $choice_new[] = $_POST['choice'][$i];
             $answer_new[] = $_POST['answer'][$i];
         }
     }
     $_POST['answer'] = $answer_new;
     $_POST['choice'] = $choice_new;
     $_POST['answer'] = array_pad($_POST['answer'], 10, 0);
     $_POST['choice'] = array_pad($_POST['choice'], 10, '');
     $sql = "UPDATE %stests_questions SET\n            category_id=%d,\n            feedback='%s',\n            question='%s',\n            choice_0='%s',\n            choice_1='%s',\n            choice_2='%s',\n            choice_3='%s',\n            choice_4='%s',\n            choice_5='%s',\n            choice_6='%s',\n            choice_7='%s',\n            choice_8='%s',\n            choice_9='%s',\n            answer_0=%d,\n            answer_1=%d,\n            answer_2=%d,\n            answer_3=%d,\n            answer_4=%d,\n            answer_5=%d,\n            answer_6=%d,\n            answer_7=%d,\n            answer_8=%d,\n            answer_9=%d,\n            remedial_content='%s'\n            WHERE question_id=%d AND course_id=%d";
开发者ID:genaromendezl,项目名称:ATutor,代码行数:31,代码来源:edit_question_multianswer.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP validate_manifest函数代码示例发布时间:2022-05-23
下一篇:
PHP validate_ip函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap