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

PHP getRoleSubordinates函数代码示例

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

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



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

示例1: getComboArray

/** Function to  returns the combo field values in array format
 * @param $combofieldNames -- combofieldNames:: Type string array
 * @returns $comboFieldArray -- comboFieldArray:: Type string array
 */
function getComboArray($combofieldNames)
{
    global $log, $mod_strings;
    $log->debug("Entering getComboArray(" . $combofieldNames . ") method ...");
    global $adb, $current_user;
    $roleid = $current_user->roleid;
    $comboFieldArray = array();
    foreach ($combofieldNames as $tableName => $arrayName) {
        $fldArrName = $arrayName;
        $arrayName = array();
        $sql = "select {$tableName} from vtiger_{$tableName}";
        $params = array();
        if (!is_admin($current_user)) {
            $subrole = getRoleSubordinates($roleid);
            if (count($subrole) > 0) {
                $roleids = $subrole;
                array_push($roleids, $roleid);
            } else {
                $roleids = $roleid;
            }
            $sql = "select distinct {$tableName} from vtiger_{$tableName}  inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_{$tableName}.picklist_valueid where roleid in(" . generateQuestionMarks($roleids) . ") order by sortid";
            $params = array($roleids);
        }
        $result = $adb->pquery($sql, $params);
        while ($row = $adb->fetch_array($result)) {
            $val = $row[$tableName];
            $arrayName[$val] = getTranslatedString($val);
        }
        $comboFieldArray[$fldArrName] = $arrayName;
    }
    $log->debug("Exiting getComboArray method ...");
    return $comboFieldArray;
}
开发者ID:hbsman,项目名称:vtigercrm-5.3.0-ja,代码行数:37,代码来源:ComboUtil.php


示例2: getSubordinateRoleAndUsers

/** To retreive the subordinate vtiger_roles and vtiger_users of the specified parent vtiger_role
  * @param $roleid -- The Role Id:: Type varchar
  * @returns  subordinate vtiger_role array in the following format:
  *     $subordinateRoleUserArray=(roleid1=>Array(userid1,userid2,userid3),
                               vtiger_roleid2=>Array(userid1,userid2,userid3)
				                |
						|
			       vtiger_roleidn=>Array(userid1,userid2,userid3));
 */
function getSubordinateRoleAndUsers($roleId, $users = true)
{
    global $log;
    $log->debug("Entering getSubordinateRoleAndUsers(" . $roleId . ") method ...");
    global $adb;
    $subRoleAndUsers = array();
    $subordinateRoles = getRoleSubordinates($roleId);
    $userArray = array();
    foreach ($subordinateRoles as $subRoleId) {
        if ($users) {
            $userArray = getRoleUsers($subRoleId);
        }
        $subRoleAndUsers[$subRoleId] = $userArray;
    }
    $log->debug("Exiting getSubordinateRoleAndUsers method ...");
    return $subRoleAndUsers;
}
开发者ID:jaimeaga84,项目名称:corebos,代码行数:26,代码来源:UserInfoUtil.php


示例3: getAccessPickListValues

 /** Function to get picklist value array based on profile
  *          *  returns permitted fields in array format
  **/
 function getAccessPickListValues()
 {
     $adb = PearDatabase::getInstance();
     $current_user = vglobal('current_user');
     $id = array(getTabid($this->primarymodule));
     if ($this->secondarymodule != '') {
         array_push($id, getTabid($this->secondarymodule));
     }
     $query = 'select fieldname,columnname,fieldid,fieldlabel,tabid,uitype from vtiger_field where tabid in(' . generateQuestionMarks($id) . ') and uitype in (15,33,55)';
     //and columnname in (?)';
     $result = $adb->pquery($query, $id);
     //,$select_column));
     $roleid = $current_user->roleid;
     $subrole = getRoleSubordinates($roleid);
     if (count($subrole) > 0) {
         $roleids = $subrole;
         array_push($roleids, $roleid);
     } else {
         $roleids = $roleid;
     }
     $temp_status = array();
     for ($i = 0; $i < $adb->num_rows($result); $i++) {
         $fieldname = $adb->query_result($result, $i, "fieldname");
         $fieldlabel = $adb->query_result($result, $i, "fieldlabel");
         $tabid = $adb->query_result($result, $i, "tabid");
         $uitype = $adb->query_result($result, $i, "uitype");
         $fieldlabel1 = str_replace(" ", "__", $fieldlabel);
         $keyvalue = getTabModuleName($tabid) . "__" . $fieldlabel1;
         $fieldvalues = array();
         if (count($roleids) > 1) {
             $mulsel = "select distinct {$fieldname} from vtiger_{$fieldname} inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_{$fieldname}.picklist_valueid where roleid in (\"" . implode($roleids, "\",\"") . "\") and picklistid in (select picklistid from vtiger_{$fieldname})";
             // order by sortid asc - not requried
         } else {
             $mulsel = "select distinct {$fieldname} from vtiger_{$fieldname} inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_{$fieldname}.picklist_valueid where roleid ='" . $roleid . "' and picklistid in (select picklistid from vtiger_{$fieldname})";
             // order by sortid asc - not requried
         }
         if ($fieldname != 'firstname') {
             $mulselresult = $adb->query($mulsel);
         }
         for ($j = 0; $j < $adb->num_rows($mulselresult); $j++) {
             $fldvalue = $adb->query_result($mulselresult, $j, $fieldname);
             if (in_array($fldvalue, $fieldvalues)) {
                 continue;
             }
             $fieldvalues[] = $fldvalue;
         }
         $field_count = count($fieldvalues);
         if ($uitype == 15 && $field_count > 0 && ($fieldname == 'taskstatus' || $fieldname == 'eventstatus')) {
             $temp_count = count($temp_status[$keyvalue]);
             if ($temp_count > 0) {
                 for ($t = 0; $t < $field_count; $t++) {
                     $temp_status[$keyvalue][$temp_count + $t] = $fieldvalues[$t];
                 }
                 $fieldvalues = $temp_status[$keyvalue];
             } else {
                 $temp_status[$keyvalue] = $fieldvalues;
             }
         }
         if ($uitype == 33) {
             $fieldlists[1][$keyvalue] = $fieldvalues;
         } else {
             if ($uitype == 55 && $fieldname == 'salutationtype') {
                 $fieldlists[$keyvalue] = $fieldvalues;
             } else {
                 if ($uitype == 15) {
                     $fieldlists[$keyvalue] = $fieldvalues;
                 }
             }
         }
     }
     return $fieldlists;
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:75,代码来源:ReportRun.php


示例4: constructTodoListView

/**
 * Function creates HTML to display Todos ListView
 * @param array  $todo_list     - collection of strings(Todo Information)
 * @param array  $cal           - collection of objects and strings 
 * return string $list_view     - html tags in string format
 */
function constructTodoListView($todo_list, $cal, $subtab, $navigation_array = '')
{
    global $mod_strings, $cal_log, $adb, $theme;
    $cal_log->debug("Entering constructTodoListView() method...");
    global $current_user, $app_strings;
    $date_format = $current_user->date_format;
    $format = $cal['calendar']->hour_format;
    $hour_startat = timeString(array('hour' => date('H:i'), 'minute' => 0), '24');
    $hour_endat = timeString(array('hour' => date('H:i', time() + 60 * 60), 'minute' => 0), '24');
    $time_arr = getaddEventPopupTime($hour_startat, $hour_endat, $format);
    $temp_ts = $cal['calendar']->date_time->ts;
    //to get date in user selected date format
    $temp_date = $date_format == 'dd-mm-yyyy' ? date('d-m-Y', $temp_ts) : ($date_format == 'mm-dd-yyyy' ? date('m-d-Y', $temp_ts) : ($date_format == 'yyyy-mm-dd' ? date('Y-m-d', $temp_ts) : ''));
    if ($cal['calendar']->day_start_hour != 23) {
        $endtemp_date = $temp_date;
    } else {
        $endtemp_ts = $temp_ts + 1 * 24 * 60 * 60;
        $endtemp_date = $date_format == 'dd-mm-yyyy' ? date('d-m-Y', $endtemp_ts) : ($date_format == 'mm-dd-yyyy' ? date('m-d-Y', $endtemp_ts) : ($date_format == 'yyyy-mm-dd' ? date('Y-m-d', $endtemp_ts) : ''));
    }
    $list_view = "";
    //labels of listview header
    if ($cal['view'] == 'day') {
        $colspan = 9;
        $header = array('0' => '#', '1' => $mod_strings['LBL_TIME'], '2' => $mod_strings['LBL_LIST_DUE_DATE'], '3' => $mod_strings['LBL_TODO']);
        $header_width = array('0' => '5%', '1' => '10%', '2' => '10%', '3' => '38%');
        /*if(getFieldVisibilityPermission('Calendar',$current_user->id,'parent_id') == '0')
        		{
        			array_push($header,$mod_strings['LBL_RELATEDTO']);
        			array_push($header_width,'15%');
        		}
        		if(getFieldVisibilityPermission('Calendar',$current_user->id,'contact_id') == '0')
        		{
        			array_push($header,$mod_strings['LBL_CONTACT_NAME']);
        			array_push($header_width,'15%');
        		}*/
        if (getFieldVisibilityPermission('Calendar', $current_user->id, 'taskstatus') == '0') {
            array_push($header, $mod_strings['LBL_STATUS']);
            array_push($header_width, '10%');
        }
        if (isPermitted("Calendar", "EditView") == "yes" || isPermitted("Calendar", "Delete") == "yes") {
            array_push($header, $mod_strings['LBL_ACTION']);
            array_push($header_width, '10%');
        }
        array_push($header, $mod_strings['LBL_ASSINGEDTO']);
        array_push($header_width, '15%');
    } else {
        $colspan = 10;
        $header = array('0' => '#', '1' => $mod_strings['LBL_TIME'], '2' => $mod_strings['LBL_START_DATE'], '3' => $mod_strings['LBL_DUE_DATE'], '4' => $mod_strings['LBL_TODO']);
        $header_width = array('0' => '5%', '1' => '10%', '2' => '10%', '3' => '10%', '4' => '28%');
        /*if(getFieldVisibilityPermission('Calendar',$current_user->id,'parent_id') == '0')
        		{
        			array_push($header,$mod_strings['LBL_RELATEDTO']);
        			array_push($header_width,'15%');
        		}
        		if(getFieldVisibilityPermission('Calendar',$current_user->id,'contact_id') == '0')
        		{
        			array_push($header,$mod_strings['LBL_CONTACT_NAME']);
        			array_push($header_width,'15%');
        		}*/
        if (getFieldVisibilityPermission('Calendar', $current_user->id, 'taskstatus') == '0') {
            array_push($header, $mod_strings['LBL_STATUS']);
            array_push($header_width, '10%');
        }
        if (isPermitted("Calendar", "EditView") == "yes" || isPermitted("Calendar", "Delete") == "yes") {
            array_push($header, $mod_strings['LBL_ACTION']);
        }
        array_push($header, $mod_strings['LBL_ASSINGEDTO']);
        array_push($header_width, '15%');
    }
    if ($current_user->column_fields['is_admin'] == 'on') {
        $Res = $adb->pquery("select * from vtiger_activitytype", array());
    } else {
        $roleid = $current_user->roleid;
        $subrole = getRoleSubordinates($roleid);
        if (count($subrole) > 0) {
            $roleids = $subrole;
            array_push($roleids, $roleid);
        } else {
            $roleids = $roleid;
        }
        if (count($roleids) > 1) {
            $Res = $adb->pquery("select distinct activitytype from  vtiger_activitytype inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_activitytype.picklist_valueid where roleid in (" . generateQuestionMarks($roleids) . ") and picklistid in (select picklistid from vtiger_activitytype) order by sortid asc", array($roleids));
        } else {
            $Res = $adb->pquery("select distinct activitytype from vtiger_activitytype inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_activitytype.picklist_valueid where roleid = ? and picklistid in (select picklistid from vtiger_activitytype) order by sortid asc", array($roleid));
        }
    }
    $eventlist = '';
    for ($i = 0; $i < $adb->num_rows($Res); $i++) {
        $eventlist .= $adb->query_result($Res, $i, 'activitytype') . ";";
    }
    $list_view .= "<table align='center' border='0' cellpadding='5' cellspacing='0' width='98%'>\n\t\t\t<tr><td colspan='3'>&nbsp;</td></tr>";
    //checking permission for Create/Edit Operation
    if (isPermitted("Calendar", "EditView") == "yes") {
        $list_view .= "<tr>\n\t\t\t\t<td class='calAddButton' onMouseOver='fnAddEvent(this,\"addEventDropDown\",\"" . $temp_date . "\",\"" . $endtemp_date . "\",\"" . $time_arr['starthour'] . "\",\"" . $time_arr['startmin'] . "\",\"" . $time_arr['startfmt'] . "\",\"" . $time_arr['endhour'] . "\",\"" . $time_arr['endmin'] . "\",\"" . $time_arr['endfmt'] . "\",\"\",\"" . $subtab . "\",\"" . $eventlist . "\");'style='border: 1px solid #666666;cursor:pointer;height:30px' align='center' width='10%'>\n                                        " . $mod_strings['LBL_ADD'] . "\n                                        <img src='" . vtiger_imageurl('menuDnArrow.gif', $theme) . "' style='padding-left: 5px;' border='0'>                                                                                                                         </td>";
//.........这里部分代码省略.........
开发者ID:p6,项目名称:VF,代码行数:101,代码来源:calendarLayout.php


示例5: getActStatusFieldValues

 function getActStatusFieldValues($fieldname, $tablename)
 {
     global $adb, $mod_strings, $current_user, $default_charset;
     require 'user_privileges/user_privileges_' . $current_user->id . '.php';
     if (count($this->View) > 0) {
         $load_ch = true;
     } else {
         $load_ch = false;
     }
     $type = "";
     if ($fieldname == "eventstatus") {
         $type = "3";
     } elseif ($fieldname == "taskstatus") {
         $type = "4";
     } elseif ($fieldname == "taskpriority") {
         $type = "5";
     }
     $Data = array();
     if ($is_admin) {
         $q = "select * from " . $tablename;
     } else {
         $roleid = $current_user->roleid;
         $subrole = getRoleSubordinates($roleid);
         if (count($subrole) > 0) {
             $roleids = $subrole;
             array_push($roleids, $roleid);
         } else {
             $roleids = $roleid;
         }
         if (count($roleids) > 1) {
             $q = "select distinct {$fieldname}, picklist_valueid from  {$tablename} inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = {$tablename}.picklist_valueid where roleid in (\"" . implode($roleids, "\",\"") . "\") and picklistid in (select picklistid from {$tablename}) order by sortid asc";
         } else {
             $q = "select distinct {$fieldname}, picklist_valueid from {$tablename} inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = {$tablename}.picklist_valueid where roleid ='" . $roleid . "' and picklistid in (select picklistid from {$tablename}) order by sortid asc";
         }
     }
     $Res = $adb->query($q);
     $noofrows = $adb->num_rows($Res);
     for ($i = 0; $i < $noofrows; $i++) {
         $checked = true;
         $valueid = $adb->query_result($Res, $i, "picklist_valueid");
         $value = $adb->query_result($Res, $i, $fieldname);
         $value = html_entity_decode($value, ENT_QUOTES, $default_charset);
         $label = getTranslatedString($value, 'Calendar');
         if ($type != "" || $load_ch) {
             if (!empty($this->View[$type][$valueid])) {
                 $checked = false;
             }
         }
         $Data[$value] = array("id" => $valueid, "value" => $value, "label" => $label, "checked" => $checked);
     }
     return $Data;
 }
开发者ID:mslokhat,项目名称:corebos,代码行数:52,代码来源:Calendar4You.php


示例6: timeString

$smarty->assign('ID', $focus->id);
$smarty->assign('MODE', $focus->mode);
$viewBox = 'hourview';
if ($Calendar4You->CheckPermissions("EDIT")) {
    $smarty->assign('EDIT', 'permitted');
    $hour_startat = timeString(array('hour' => date('H:i', time() + 5 * 60), 'minute' => 0), '24');
    $hour_endat = timeString(array('hour' => date('H:i', time() + 60 * 60), 'minute' => 0), '24');
    $time_arr = getaddITSEventPopupTime($hour_startat, $hour_endat, $Calendar_Settings["hour_format"]);
    $date = new DateTimeField(null);
    //To get date in user selected format
    $temp_date = $date->getDisplayDate();
    if ($current_user->column_fields['is_admin'] == 'on') {
        $Res = $adb->pquery("select * from vtiger_activitytype", array());
    } else {
        $roleid = $current_user->roleid;
        $subrole = getRoleSubordinates($roleid);
        if (count($subrole) > 0) {
            $roleids = $subrole;
            array_push($roleids, $roleid);
        } else {
            $roleids = $roleid;
        }
        if (count($roleids) > 1) {
            $Res = $adb->pquery("select distinct activitytype from  vtiger_activitytype inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_activitytype.picklist_valueid where roleid in (" . generateQuestionMarks($roleids) . ") and picklistid in (select picklistid from vtiger_activitytype) order by sortid asc", array($roleids));
        } else {
            $Res = $adb->pquery("select distinct activitytype from vtiger_activitytype inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_activitytype.picklist_valueid where roleid = ? and picklistid in (select picklistid from vtiger_activitytype) order by sortid asc", array($roleid));
        }
    }
    $eventlist = '';
    $eventlists_array = '';
    for ($i = 0; $i < $adb->num_rows($Res); $i++) {
开发者ID:jgjermeni,项目名称:corebos,代码行数:31,代码来源:CalendarView.php


示例7: picklist_check

function picklist_check($module, $graph_by)
{
    global $current_user, $adb;
    $pick_query = '';
    require 'user_privileges/user_privileges_' . $current_user->id . '.php';
    $roleid = $current_user->roleid;
    $subrole = getRoleSubordinates($roleid);
    if (count($subrole) > 0) {
        $roleids = $subrole;
        array_push($roleids, $roleid);
    } else {
        $roleids = $roleid;
    }
    if ($graph_by == 'sostatus' || $graph_by == 'leadsource' || $graph_by == 'leadstatus' || $graph_by == 'industry' || $graph_by == 'productcategory' || $graph_by == 'postatus' || $graph_by == 'invoicestatus' || $graph_by == 'ticketstatus' || $graph_by == 'priority' || $graph_by == 'category' || $graph_by == 'quotestage') {
        $temp_fieldname = $graph_by;
        if ($graph_by == 'priority') {
            $temp_fieldname = 'ticketpriorities';
        }
        if ($graph_by == 'category') {
            $temp_fieldname = 'ticketcategories';
        }
        if (count($roleids) > 1) {
            $pick_query = " in (select distinct {$temp_fieldname} from vtiger_" . $temp_fieldname . "  inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_" . $temp_fieldname . ".picklist_valueid where roleid in (\"" . implode($roleids, "\",\"") . "\")) ";
        } else {
            $pick_query = " in (select distinct {$temp_fieldname} from vtiger_" . $temp_fieldname . "  inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_" . $temp_fieldname . ".picklist_valueid where roleid in ('{$roleids}')) ";
        }
    }
    return $pick_query;
}
开发者ID:sacredwebsite,项目名称:vtigercrm,代码行数:29,代码来源:display_charts.php


示例8: getRoleBasesdPickList

function getRoleBasesdPickList($fldname, $exist_val)
{
    global $adb, $app_strings, $current_user;
    $is_Admin = $current_user->is_admin;
    if ($is_Admin == 'off' && $fldname != '') {
        $roleid = $current_user->roleid;
        $roleids = array();
        $subrole = getRoleSubordinates($roleid);
        if (count($subrole) > 0) {
            $roleids = $subrole;
        }
        array_push($roleids, $roleid);
        //here we are checking wheather the table contains the sortorder column .If  sortorder is present in the main picklist table, then the role2picklist will be applicable for this table...
        $sql = "select * from vtiger_{$fldname} where {$fldname}=?";
        $res = $adb->pquery($sql, array(decode_html($exist_val)));
        $picklistvalueid = $adb->query_result($res, 0, 'picklist_valueid');
        if ($picklistvalueid != null) {
            $pick_query = "select * from vtiger_role2picklist where picklistvalueid={$picklistvalueid} and roleid in (" . generateQuestionMarks($roleids) . ")";
            $res_val = $adb->pquery($pick_query, array($roleids));
            $num_val = $adb->num_rows($res_val);
        }
        if ($num_val > 0) {
            $pick_val = $exist_val;
        } else {
            $pick_val = $app_strings['LBL_NOT_ACCESSIBLE'];
        }
    } else {
        $pick_val = $exist_val;
    }
    return $pick_val;
}
开发者ID:vtiger-jp,项目名称:vtigercrm-5.1.x-ja,代码行数:31,代码来源:Appointment.php


示例9: getActFieldCombo

/**
 *Function to construct HTML select combo box
 *@param $fieldname -- the field name :: Type string
 *@param $tablename -- The table name :: Type string
 *constructs html select combo box for combo field
 *and returns it in string format.
 */
function getActFieldCombo($fieldname, $tablename)
{
    global $adb, $mod_strings, $current_user;
    require 'user_privileges/user_privileges_' . $current_user->id . '.php';
    $combo = '';
    $js_fn = '';
    if ($fieldname == 'eventstatus') {
        $js_fn = 'onChange = "getSelectedStatus();"';
    }
    $combo .= '<select name="' . $fieldname . '" id="' . $fieldname . '" class=small ' . $js_fn . '>';
    if ($is_admin) {
        $q = "select * from " . $tablename;
    } else {
        $roleid = $current_user->roleid;
        $subrole = getRoleSubordinates($roleid);
        if (count($subrole) > 0) {
            $roleids = $subrole;
            array_push($roleids, $roleid);
        } else {
            $roleids = $roleid;
        }
        if (count($roleids) > 1) {
            $q = "select distinct {$fieldname} from  {$tablename} inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = {$tablename}.picklist_valueid where roleid in (\"" . implode($roleids, "\",\"") . "\") and picklistid in (select picklistid from {$tablename}) order by sortid asc";
        } else {
            $q = "select distinct {$fieldname} from {$tablename} inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = {$tablename}.picklist_valueid where roleid ='" . $roleid . "' and picklistid in (select picklistid from {$tablename}) order by sortid asc";
        }
    }
    $Res = $adb->query($q);
    $noofrows = $adb->num_rows($Res);
    for ($i = 0; $i < $noofrows; $i++) {
        $value = $adb->query_result($Res, $i, $fieldname);
        $combo .= '<option value="' . $value . '">' . getTranslatedString($value) . '</option>';
    }
    $combo .= '</select>';
    return $combo;
}
开发者ID:mslokhat,项目名称:corebos,代码行数:43,代码来源:CalendarCommon.php


示例10: getITSActFieldCombo

function getITSActFieldCombo($fieldname, $tablename, $from_module = '')
{
    global $adb, $mod_strings, $current_user, $default_charset;
    require 'user_privileges/user_privileges_' . $current_user->id . '.php';
    $combo = '';
    $js_fn = '';
    $def = '';
    if ($from_module != '') {
        $from_tab_id = getTabid($from_module);
        $sql_d = "SELECT defaultvalue FROM vtiger_field WHERE uitype = '15' AND fieldname = ? AND tabid = ?";
        $Res_D = $adb->pquery($sql_d, array($fieldname, $from_tab_id));
        $noofrows_d = $adb->num_rows($Res_D);
        if ($noofrows_d == 1) {
            $def = $adb->query_result($Res_D, 0, "defaultvalue");
        }
    }
    if ($fieldname == 'eventstatus') {
        $js_fn = 'onChange = "getSelectedStatus();"';
    }
    $combo .= '<select name="' . $fieldname . '" id="' . $fieldname . '" class=small ' . $js_fn . '>';
    if ($is_admin) {
        $q = "select * from " . $tablename;
    } else {
        $roleid = $current_user->roleid;
        $subrole = getRoleSubordinates($roleid);
        if (count($subrole) > 0) {
            $roleids = $subrole;
            array_push($roleids, $roleid);
        } else {
            $roleids = $roleid;
        }
        if (count($roleids) > 1) {
            $q = "select distinct {$fieldname} from  {$tablename} inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = {$tablename}.picklist_valueid where roleid in (\"" . implode($roleids, "\",\"") . "\") and picklistid in (select picklistid from {$tablename}) order by sortid asc";
        } else {
            $q = "select distinct {$fieldname} from {$tablename} inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = {$tablename}.picklist_valueid where roleid ='" . $roleid . "' and picklistid in (select picklistid from {$tablename}) order by sortid asc";
        }
    }
    $Res = $adb->query($q);
    $noofrows = $adb->num_rows($Res);
    for ($i = 0; $i < $noofrows; $i++) {
        $value = $adb->query_result($Res, $i, $fieldname);
        $value = html_entity_decode($value, ENT_QUOTES, $default_charset);
        $label = getTranslatedString($value, 'Calendar');
        if ($value == $def) {
            $selected = " selected";
        } else {
            $selected = "";
        }
        $combo .= '<option value="' . $value . '"' . $selected . '>' . $label . '</option>';
    }
    $combo .= '</select>';
    return $combo;
}
开发者ID:mslokhat,项目名称:corebos,代码行数:53,代码来源:CalendarUtils.php


示例11: getOutputHtml


//.........这里部分代码省略.........
            $picklistValues = getAllowedPicklistModules();
            $valueArr = explode("|##|", $value);
            foreach ($valueArr as $key => $value) {
                $valueArr[$key] = trim(html_entity_decode($value, ENT_QUOTES, $default_charset));
            }
            $pickcount = 0;
            if (!empty($picklistValues)) {
                foreach ($picklistValues as $order => $pickListValue) {
                    if (in_array(trim($pickListValue), $valueArr)) {
                        $chk_val = "selected";
                        $pickcount++;
                    } else {
                        $chk_val = '';
                    }
                    if (isset($_REQUEST['file']) && $_REQUEST['file'] == 'QuickCreate') {
                        $options[] = array(htmlentities(getTranslatedString($pickListValue, $pickListValue), ENT_QUOTES, $default_charset), $pickListValue, $chk_val);
                    } else {
                        $options[] = array(getTranslatedString($pickListValue, $pickListValue), $pickListValue, $chk_val);
                    }
                }
                if ($pickcount == 0 && !empty($value)) {
                    $options[] = array($app_strings['LBL_NOT_ACCESSIBLE'], $value, 'selected');
                }
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            uasort($options, function ($a, $b) {
                return strtolower($a[0]) < strtolower($b[0]) ? -1 : 1;
            });
            $fieldvalue[] = $options;
        } elseif ($uitype == 1024) {
            $options = array();
            $arr_evo = explode(' |##| ', $value);
            $roleid = $current_user->roleid;
            $subrole = getRoleSubordinates($roleid);
            $uservalues = array_merge($subrole, array($roleid));
            for ($i = 0; $i < sizeof($uservalues); $i++) {
                $currentValId = $uservalues[$i];
                $currentValName = getRoleName($currentValId);
                if (in_array(trim($currentValId), $arr_evo)) {
                    $chk_val = 'selected';
                } else {
                    $chk_val = '';
                }
                $options[] = array($currentValName, $currentValId, $chk_val);
            }
            $fieldvalue[] = $options;
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
        } elseif ($uitype == 17) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
        } elseif ($uitype == 85) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
        } elseif ($uitype == 14) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
        } elseif ($uitype == 19 || $uitype == 20) {
            if (isset($_REQUEST['body'])) {
                $value = $_REQUEST['body'];
            }
            if ($fieldname == 'terms_conditions') {
                //Assign the value from focus->column_fields (if we create Invoice from SO the SO's terms and conditions will be loaded to Invoice's terms and conditions, etc.,)
                $value = $col_fields['terms_conditions'];
                //if the value is empty then only we should get the default Terms and Conditions
                if ($value == '' && $mode != 'edit') {
                    $value = getTermsandConditions();
开发者ID:kduqi,项目名称:corebos,代码行数:67,代码来源:EditViewUtils.php


示例12: getValue

function getValue($field_result, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, $mode, $popuptype, $returnset = '', $viewid = '')
{
    global $log, $listview_max_textlength, $app_strings, $current_language, $currentModule;
    $log->debug("Entering getValue(" . $field_result . "," . $list_result . "," . $fieldname . "," . get_class($focus) . "," . $module . "," . $entity_id . "," . $list_result_count . "," . $mode . "," . $popuptype . "," . $returnset . "," . $viewid . ") method ...");
    global $adb, $current_user, $default_charset;
    require 'user_privileges/user_privileges_' . $current_user->id . '.php';
    $tabname = getParentTab();
    $tabid = getTabid($module);
    $current_module_strings = return_module_language($current_language, $module);
    $uicolarr = $field_result[$fieldname];
    foreach ($uicolarr as $key => $value) {
        $uitype = $key;
        $colname = $value;
    }
    //added for getting event status in Custom view - Jaguar
    if ($module == 'Calendar' && ($colname == "status" || $colname == "eventstatus")) {
        $colname = "activitystatus";
    }
    //Ends
    $field_val = $adb->query_result($list_result, $list_result_count, $colname);
    if (stristr(html_entity_decode($field_val), "<a href") === false && $uitype != 8) {
        $temp_val = textlength_check($field_val);
    } elseif ($uitype != 8) {
        $temp_val = html_entity_decode($field_val, ENT_QUOTES);
    } else {
        $temp_val = $field_val;
    }
    // vtlib customization: New uitype to handle relation between modules
    if ($uitype == '10') {
        $parent_id = $field_val;
        if (!empty($parent_id)) {
            $parent_module = getSalesEntityType($parent_id);
            $valueTitle = $parent_module;
            if ($app_strings[$valueTitle]) {
                $valueTitle = $app_strings[$valueTitle];
            }
            $displayValueArray = getEntityName($parent_module, $parent_id);
            if (!empty($displayValueArray)) {
                foreach ($displayValueArray as $key => $value) {
                    $displayValue = $value;
                }
            }
            $value = "<a href='index.php?module={$parent_module}&action=DetailView&record={$parent_id}' title='{$valueTitle}'>{$displayValue}</a>";
        } else {
            $value = '';
        }
    } else {
        if ($uitype == 53) {
            $value = textlength_check($adb->query_result($list_result, $list_result_count, 'user_name'));
            // When Assigned To field is used in Popup window
            if ($value == '') {
                $user_id = $adb->query_result($list_result, $list_result_count, 'smownerid');
                if ($user_id != null && $user_id != '') {
                    $value = getOwnerName($user_id);
                }
            }
        } elseif ($uitype == 52) {
            $value = getUserName($adb->query_result($list_result, $list_result_count, $colname));
        } elseif ($uitype == 51) {
            $parentid = $adb->query_result($list_result, $list_result_count, "parentid");
            if ($module == 'Accounts') {
                $entity_name = textlength_check(getAccountName($parentid));
            } elseif ($module == 'Products') {
                $entity_name = textlength_check(getProductName($parentid));
            }
            $value = '<a href="index.php?module=' . $module . '&action=DetailView&record=' . $parentid . '&parenttab=' . $tabname . '" style="' . $P_FONT_COLOR . '">' . $entity_name . '</a>';
        } elseif ($uitype == 77) {
            $value = getUserName($adb->query_result($list_result, $list_result_count, 'inventorymanager'));
        } elseif ($uitype == 5 || $uitype == 6 || $uitype == 23 || $uitype == 70) {
            if ($temp_val != '' && $temp_val != '0000-00-00') {
                $value = getDisplayDate($temp_val);
            } elseif ($temp_val == '0000-00-00') {
                $value = '';
            } else {
                $value = $temp_val;
            }
        } elseif ($uitype == 15 || $uitype == 55 && $fieldname == "salutationtype") {
            $temp_val = decode_html($adb->query_result($list_result, $list_result_count, $colname));
            if ($is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $temp_val != '') {
                $temp_acttype = $adb->query_result($list_result, $list_result_count, 'activitytype');
                if ($temp_acttype != 'Task' && $fieldname == "taskstatus") {
                    $temptable = "eventstatus";
                } else {
                    $temptable = $fieldname;
                }
                $roleid = $current_user->roleid;
                $roleids = array();
                $subrole = getRoleSubordinates($roleid);
                if (count($subrole) > 0) {
                    $roleids = $subrole;
                }
                array_push($roleids, $roleid);
                //here we are checking wheather the table contains the sortorder column .If  sortorder is present in the main picklist table, then the role2picklist will be applicable for this table...
                $sql = "select * from vtiger_{$temptable} where {$temptable}=?";
                $res = $adb->pquery($sql, array(decode_html($temp_val)));
                $picklistvalueid = $adb->query_result($res, 0, 'picklist_valueid');
                if ($picklistvalueid != null) {
                    $pick_query = "select * from vtiger_role2picklist where picklistvalueid={$picklistvalueid} and roleid in (" . generateQuestionMarks($roleids) . ")";
                    $res_val = $adb->pquery($pick_query, array($roleids));
                    $num_val = $adb->num_rows($res_val);
//.........这里部分代码省略.........
开发者ID:latechdirect,项目名称:vtiger,代码行数:101,代码来源:ListViewUtils.php


示例13: insertIntoEntityTable


//.........这里部分代码省略.........
                     $fldvalue = '0';
                 }
             } elseif ($uitype == 15 || $uitype == 16 || $uitype == 1613) {
                 if ($this->column_fields[$fieldname] == $app_strings['LBL_NOT_ACCESSIBLE']) {
                     //If the value in the request is Not Accessible for a picklist, the existing value will be replaced instead of Not Accessible value.
                     $sql = "select {$columname} from  {$table_name} where " . $this->tab_name_index[$table_name] . "=?";
                     $res = $adb->pquery($sql, array($this->id));
                     $pick_val = $adb->query_result($res, 0, $columname);
                     $fldvalue = $pick_val;
                 } else {
                     $fldvalue = $this->column_fields[$fieldname];
                 }
             } elseif ($uitype == 33 || $uitype == 3313 || $uitype == 1024) {
                 if (!is_array($this->column_fields[$fieldname])) {
                     $this->column_fields[$fieldname] = array_map('trim', explode('|##|', $this->column_fields[$fieldname]));
                 }
                 $sql = "select columnname,tablename from vtiger_field where tabid=? and fieldname=?";
                 $res = $adb->pquery($sql, array($tabid, $fieldname));
                 $colj = $adb->query_result($res, 0, 0);
                 $tabj = $adb->query_result($res, 0, 1);
                 $sql1 = "select {$colj} from {$tabj} where " . $this->tab_name_index[$tabj] . "=?";
                 $res = $adb->pquery($sql1, array($this->id));
                 $vlera = $adb->query_result($res, 0, $colj);
                 if (empty($vlera)) {
                     $currentvalues = array();
                 } else {
                     $currentvalues = array_map('trim', explode('|##|', decode_html($vlera)));
                 }
                 $selectedvalues = $this->column_fields[$fieldname];
                 if ($uitype == 3313) {
                     $uservalues = getAllowedPicklistModules();
                 } elseif ($uitype == 1024) {
                     $roleid = $current_user->roleid;
                     $subrole = getRoleSubordinates($roleid);
                     $uservalues = array_merge($subrole, array($roleid));
                 } else {
                     $roleid = $current_user->roleid;
                     $uservalues = getAssignedPicklistValues($fieldname, $roleid, $adb);
                 }
                 $vek = array_unique(array_merge(array_diff($currentvalues, $uservalues), $selectedvalues));
                 $fldvalue = implode(' |##| ', $vek);
             } elseif ($uitype == 5 || $uitype == 6 || $uitype == 23) {
                 //Added to avoid function call getDBInsertDateValue in ajax save
                 if (isset($current_user->date_format) && !$ajaxSave) {
                     $fldvalue = getValidDBInsertDateValue($this->column_fields[$fieldname]);
                 } else {
                     $fldvalue = $this->column_fields[$fieldname];
                 }
             } elseif ($uitype == 7) {
                 //strip out the spaces and commas in numbers if given ie., in amounts there may be ,
                 $fldvalue = str_replace(",", "", $this->column_fields[$fieldname]);
                 //trim($this->column_fields[$fieldname],",");
             } elseif ($uitype == 26) {
                 if (empty($this->column_fields[$fieldname])) {
                     $fldvalue = 1;
                     //the documents will stored in default folder
                 } else {
                     $fldvalue = $this->column_fields[$fieldname];
                 }
             } elseif ($uitype == 28) {
                 if ($this->column_fields[$fieldname] == null) {
                     $fileQuery = $adb->pquery("SELECT filename from vtiger_notes WHERE notesid = ?", array($this->id));
                     $fldvalue = null;
                     if (isset($fileQuery)) {
                         $rowCount = $adb->num_rows($fileQuery);
                         if ($rowCount > 0) {
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:67,代码来源:CRMEntity.php


示例14: getAccessPickListValues

/**	Function used to get all the picklists and their values for a module
	@param string $module - Module name to which the list of picklists and their values needed
	@return array $fieldlists - Array of picklists and their values
**/
function getAccessPickListValues($module)
{
    global $adb, $log;
    global $current_user;
    $log->debug("Entering into function getAccessPickListValues({$module})");
    $id = getTabid($module);
    $query = "select fieldname,columnname,fieldid,fieldlabel,tabid,uitype from vtiger_field where tabid = ? and uitype in ('15','33','55') and vtiger_field.presence in (0,2)";
    $result = $adb->pquery($query, array($id));
    $roleid = $current_user->roleid;
    $subrole = getRoleSubordinates($roleid);
    if (count($subrole) > 0) {
        $roleids = $subrole;
        array_push($roleids, $roleid);
    } else {
        $roleids = $roleid;
    }
    $temp_status = array();
    for ($i = 0; $i < $adb->num_rows($result); $i++) {
        $fieldname = $adb->query_result($result, $i, "fieldname");
        $fieldlabel = $adb->query_result($result, $i, "fieldlabel");
        $columnname = $adb->query_result($result, $i, "columnname");
        $tabid = $adb->query_result($result, $i, "tabid");
        $uitype = $adb->query_result($result, $i, "uitype");
        $keyvalue = $columnname;
        $fieldvalues = array();
        if (count($roleids) > 1) {
            $mulsel = "select distinct {$fieldname} from vtiger_{$fieldname} inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_{$fieldname}.picklist_valueid where roleid in (\"" . implode($roleids, "\",\"") . "\") and picklistid in (select picklistid from vtiger_{$fieldname}) order by sortid asc";
        } else {
            $mulsel = "select distinct {$fieldname} from vtiger_{$fieldname} inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_{$fieldname}.picklist_valueid where roleid ='" . $roleid . "' and picklistid in (select picklistid from vtiger_{$fieldname}) order by sortid asc";
        }
        if ($fieldname != 'firstname') {
            $mulselresult = $adb->query($mulsel);
        }
        for ($j = 0; $j < $adb->num_rows($mulselresult); $j++) {
            $fieldvalues[] = $adb->query_result($mulselresult, $j, $fieldname);
        }
        $field_count = count($fieldvalues);
        if ($uitype == 15 && $field_count > 0 && ($fieldname == 'taskstatus' || $fieldname == 'eventstatus')) {
            $temp_count = count($temp_status[$keyvalue]);
            if ($temp_count > 0) {
                for ($t = 0; $t < $field_count; $t++) {
                    $temp_status[$keyvalue][$temp_count + $t] = $fieldvalues[$t];
                }
                $fieldvalues = $temp_status[$keyvalue];
            } else {
                $temp_status[$keyvalue] = $fieldvalues;
            }
        }
        if ($uitype == 33) {
            $fieldlists[1][$keyvalue] = $fieldvalues;
        } else {
            if ($uitype == 55 && $fieldname == 'salutationtype') {
                $fieldlists[$keyvalue] = $fieldvalues;
            } else {
                if ($uitype == 15) {
                    $fieldlists[$keyvalue] = $fieldvalues;
                }
            }
        }
    }
    $log->debug("Exit from function getAccessPickListValues({$module})");
    return $fieldlists;
}
开发者ID:yunter,项目名称:crm,代码行数:67,代码来源:utils.php


示例15: getFilterColHtml


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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