Ejemplo n.º 1
0
/**
 * ilike_content_list_sql 
 * 
 * @param array $pObject 
 * @param array $pParamHash 
 * @access public
 * @return boolean TRUE on success, FALSE on failure - $this->mErrors will contain reason for failure
 */
function ilike_content_list_sql(&$pObject, &$pParamHash = NULL)
{
    global $gBitSystem, $gBitDbType;
    $ret = array();
    if (!empty($pParamHash['highlight'])) {
        $pSearchHash = $pParamHash;
        $pSearchHash['find'] = $pSearchHash['highlight'];
        $selectSql = $whereSql = $orderSql = $joinSql = '';
        $bindVars = array();
        // create valid search SQL
        iLike::prepareSearchSql($pSearchHash, $whereSql, $bindVars, TRUE);
        $ret['join_sql'] = " LEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_content_data` ilikelcds ON ( lc.`content_id` = ilikelcds.`content_id` AND ilikelcds.`data_type` = 'summary' ) ";
        $ret['where_sql'] = $whereSql;
        $ret['bind_vars'] = $bindVars;
        if (!empty($pParamHash['highlight'])) {
            $pParamHash['listInfo']['highlight'] = $pParamHash['highlight'];
            $pParamHash['listInfo']['ihash']['highlight'] = $pParamHash['highlight'];
        }
        if (!empty($pParamHash['join'])) {
            $pParamHash['listInfo']['join'] = $pParamHash['join'];
            $pParamHash['listInfo']['ihash']['join'] = $pParamHash['join'];
        }
    }
    return $ret;
}
Ejemplo n.º 2
0
<?php

// Initialization
require_once '../kernel/setup_inc.php';
require_once ILIKE_PKG_PATH . 'iLike.php';
$gBitSystem->verifyPackage('ilike');
$gBitSystem->verifyPermission('p_ilike_search');
$gLike = new iLike();
$feedback = array();
if (empty($contentTypes)) {
    foreach ($gLibertySystem->mContentTypes as $cType) {
        $contentTypes[$cType['content_type_guid']] = $gLibertySystem->getContentTypeName($cType['content_type_guid']);
    }
}
$gBitSmarty->assign('contentTypes', $contentTypes);
$_REQUEST['find'] = !empty($_REQUEST['highlight']) ? $_REQUEST['highlight'] : NULL;
if (empty($_REQUEST['content_limit']) && !empty($_REQUEST['content_type_guid'])) {
    unset($_REQUEST['content_type_guid']);
}
$searchHash = $_REQUEST;
if (!empty($_REQUEST['find']) && ($results = $gLike->search($searchHash))) {
    $gBitSmarty->assign("results", $results);
} elseif (!empty($_REQUEST['find'])) {
    $feedback['error'] = $gLike->mErrors;
}
// adding contenttype to listInfo is a little complex - this replicates code in liberty::get_content_list_inc.php
if (!empty($_REQUEST['content_limit']) && !empty($_REQUEST['content_type_guid'])) {
    if (!is_array($_REQUEST['content_type_guid'])) {
        $guids = explode(",", $_REQUEST['content_type_guid']);
    } else {
        $guids = $_REQUEST['content_type_guid'];