本文整理匯總了PHP中Vtiger_Widget_Model::getInstanceFromValues方法的典型用法代碼示例。如果您正苦於以下問題:PHP Vtiger_Widget_Model::getInstanceFromValues方法的具體用法?PHP Vtiger_Widget_Model::getInstanceFromValues怎麽用?PHP Vtiger_Widget_Model::getInstanceFromValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Vtiger_Widget_Model
的用法示例。
在下文中一共展示了Vtiger_Widget_Model::getInstanceFromValues方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getSelectableDashboard
public function getSelectableDashboard()
{
global $log;
$log->debug("Entering Settings_WidgetsManagement_Module_Model::getSelectableDashboard() method ...");
$db = PearDatabase::getInstance();
$currentUser = Users_Record_Model::getCurrentUserModel();
$sql = 'SELECT * FROM vtiger_links WHERE linktype = ?';
$params = array('DASHBOARDWIDGET');
$result = $db->pquery($sql, $params);
$widgets = array();
for ($i = 0; $i < $db->num_rows($result); $i++) {
$row = $db->query_result_rowdata($result, $i);
$moduleName = Vtiger_Functions::getModuleName($row['tabid']);
if ($moduleName != 'Home' && ($row['linklabel'] == 'Mini List' || $row['linklabel'] == 'Notebook')) {
continue;
}
if ($row['linklabel'] == 'Tag Cloud') {
$isTagCloudExists = getTagCloudView($currentUser->getId());
if ($isTagCloudExists == 'false') {
continue;
}
}
$moduleName = Vtiger_Functions::getModuleName($row['tabid']);
$widgets[$moduleName][] = Vtiger_Widget_Model::getInstanceFromValues($row);
}
$log->debug("Exiting Settings_WidgetsManagement_Module_Model::getSelectableDashboard() method ...");
return $widgets;
}
示例2: getDashboards
/**
* Function returns List of User's selected Dashboard Widgets
* @return <Array of Vtiger_Widget_Model>
*/
public function getDashboards()
{
$db = PearDatabase::getInstance();
$currentUser = Users_Record_Model::getCurrentUserModel();
$moduleModel = $this->getModule();
$sql = " SELECT vtiger_links.*, vtiger_module_dashboard_widgets.userid, vtiger_module_dashboard_widgets.id as widgetid, vtiger_module_dashboard_widgets.position as position, vtiger_links.linkid as id FROM vtiger_links " . " INNER JOIN vtiger_module_dashboard_widgets ON vtiger_links.linkid=vtiger_module_dashboard_widgets.linkid" . " WHERE (vtiger_module_dashboard_widgets.userid = ? AND linktype = ? AND tabid = ?)";
$params = array($currentUser->getId(), 'DASHBOARDWIDGET', $moduleModel->getId());
$result = $db->pquery($sql, $params);
$widgets = array();
for ($i = 0, $len = $db->num_rows($result); $i < $len; $i++) {
$row = $db->query_result_rowdata($result, $i);
$row['linkid'] = $row['id'];
$widgets[] = Vtiger_Widget_Model::getInstanceFromValues($row);
}
foreach ($widgets as $index => $widget) {
$label = $widget->get('linklabel');
if ($label == 'Tag Cloud') {
$isTagCloudExists = getTagCloudView($currentUser->getId());
if ($isTagCloudExists === 'false') {
unset($widgets[$index]);
}
}
}
return $widgets;
}
示例3: getDefaultWidgets
/**
* Function to get the default widgets
* @return <array> - array of Widget models
*/
public function getDefaultWidgets()
{
$moduleModel = $this->getModule();
$parentWidgets = parent::getDefaultWidgets();
$widgets[] = array('contentType' => 'json', 'title' => 'Countries to be verified', 'mode' => 'open', 'url' => 'module=' . $moduleModel->getName() . '&view=ShowWidget&mode=getTbvCountries');
foreach ($widgets as $widget) {
$widgetList[] = Vtiger_Widget_Model::getInstanceFromValues($widget);
}
return $widgetList;
}
示例4: getDashboards
/**
* Function returns List of User's selected Dashboard Widgets
* @return <Array of Vtiger_Widget_Model>
*/
public function getDashboards($action = 1)
{
$db = PearDatabase::getInstance();
$currentUser = Users_Record_Model::getCurrentUserModel();
$moduleModel = $this->getModule();
if ($action == 'Header') {
$action = 0;
}
$sql = " SELECT vtiger_links.*, mdw.userid, mdw.data, mdw.active, mdw.title, mdw.filterid, mdw.id as widgetid, mdw.position as position, vtiger_links.linkid as id \n\t\t\tFROM vtiger_links \n\t\t\tINNER JOIN vtiger_module_dashboard_widgets mdw ON vtiger_links.linkid = mdw.linkid\n\t\t\tWHERE mdw.userid = ? AND linktype = ? AND tabid = ? AND `active` = ?";
$params = array($currentUser->getId(), 'DASHBOARDWIDGET', $moduleModel->getId(), $action);
$result = $db->pquery($sql, $params);
$widgets = array();
for ($i = 0, $len = $db->num_rows($result); $i < $len; $i++) {
$row = $db->query_result_rowdata($result, $i);
$row['linkid'] = $row['id'];
if ($row['linklabel'] == 'Mini List') {
$minilistWidget = Vtiger_Widget_Model::getInstanceFromValues($row);
$minilistWidgetModel = new Vtiger_MiniList_Model();
$minilistWidgetModel->setWidgetModel($minilistWidget);
$minilistWidget->set('title', $minilistWidgetModel->getTitle());
$widgets[] = $minilistWidget;
} else {
$widgets[] = Vtiger_Widget_Model::getInstanceFromValues($row);
}
}
foreach ($widgets as $index => $widget) {
$label = $widget->get('linklabel');
$url = $widget->get('linkurl');
$redex = '/module=(.+?)&+/';
preg_match($redex, $url, $match);
if (isPermitted($match[1], 'Index') == 'no') {
unset($widgets[$index]);
}
if ($label == 'Tag Cloud') {
$isTagCloudExists = getTagCloudView($currentUser->getId());
if ($isTagCloudExists === 'false') {
unset($widgets[$index]);
}
}
}
return $widgets;
}
示例5: getDashboards
/**
* Function returns List of User's selected Dashboard Widgets
* @return <Array of Vtiger_Widget_Model>
*/
public function getDashboards($action = 1)
{
$db = PearDatabase::getInstance();
$currentUser = Users_Record_Model::getCurrentUserModel();
$currentUserPrivilegeModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
$moduleModel = $this->getModule();
if ($action == 'Header') {
$action = 0;
}
$sql = " SELECT vtiger_links.*, mdw.userid, mdw.data, mdw.active, mdw.title, mdw.size, mdw.filterid, mdw.id as widgetid, mdw.position as position, vtiger_links.linkid as id, mdw.limit, mdw.owners \n\t\t\tFROM vtiger_links \n\t\t\tINNER JOIN vtiger_module_dashboard_widgets mdw ON vtiger_links.linkid = mdw.linkid\n\t\t\tWHERE mdw.userid = ? AND linktype = ? AND tabid = ? AND `active` = ?";
$params = array($currentUser->getId(), 'DASHBOARDWIDGET', $moduleModel->getId(), $action);
$result = $db->pquery($sql, $params);
$widgets = array();
for ($i = 0, $len = $db->num_rows($result); $i < $len; $i++) {
$row = $db->query_result_rowdata($result, $i);
$row['linkid'] = $row['id'];
if ($row['linklabel'] == 'Mini List') {
$minilistWidget = Vtiger_Widget_Model::getInstanceFromValues($row);
$minilistWidgetModel = new Vtiger_MiniList_Model();
$minilistWidgetModel->setWidgetModel($minilistWidget);
$minilistWidget->set('title', $minilistWidgetModel->getTitle());
$widgets[] = $minilistWidget;
} else {
$widgets[] = Vtiger_Widget_Model::getInstanceFromValues($row);
}
}
foreach ($widgets as $index => $widget) {
$label = $widget->get('linklabel');
$url = $widget->get('linkurl');
$data = $widget->get('data');
$filterid = $widget->get('filterid');
$module = $this->getModuleNameFromLink($url, $label);
if ($module == 'Home' && !empty($filterid) && !empty($data)) {
$filterData = Zend_Json::decode(htmlspecialchars_decode($data));
$module = $filterData['module'];
}
if (!$currentUserPrivilegeModel->hasModulePermission(getTabid($module))) {
unset($widgets[$index]);
}
}
return $widgets;
}
示例6: getDashboardForModule
/**
* Gets all id widgets for the module
* @param String $moduleName
* @return Array
* */
public function getDashboardForModule($moduleName)
{
$log = vglobal('log');
$log->debug("Entering Settings_WidgetsManagement_Module_Model::getDashboardForModule(" . $moduleName . ") method ...");
$adb = PearDatabase::getInstance();
$tabId = getTabid($moduleName);
$data = array();
//$data = self::getBlocksId();
$query = 'SELECT
mdw.blockid,
mdw.data,
mdw.title,
mdw.filterid,
mdw.id,
mdw.size,
mdw.limit,
mdw.isdefault,
mdw.owners,
`vtiger_links`.*,
`mdb`.`authorized`
FROM
`vtiger_module_dashboard` AS mdw
INNER JOIN `vtiger_links`
ON `mdw`.`linkid` = `vtiger_links`.`linkid`
INNER JOIN `vtiger_module_dashboard_blocks` AS mdb
ON (`mdw`.`blockid` = `mdb`.`id` AND `vtiger_links`.`tabid` = `mdb`.`tabid`)
WHERE `vtiger_links`.`tabid` = ?';
$params = array($tabId);
$result = $adb->pquery($query, $params);
$num = $adb->num_rows($result);
$userId = '';
$blockId = '';
for ($i = 0; $i < $num; $i++) {
$row = $adb->query_result_rowdata($result, $i);
if ($row['linklabel'] == 'Mini List') {
$minilistWidget = Vtiger_Widget_Model::getInstanceFromValues($row);
$minilistWidgetModel = new Vtiger_MiniList_Model();
$minilistWidgetModel->setWidgetModel($minilistWidget);
$minilistWidget->set('title', $minilistWidgetModel->getTitle());
$data[$row['blockid']][$i] = $minilistWidget;
} else
$data[$row['blockid']][$i] = Vtiger_Widget_Model::getInstanceFromValues($row);
}
$log->debug("Exiting Settings_WidgetsManagement_Module_Model::getDashboardForModule() method ...");
return $data;
}
示例7: getInstanceWithWidgetId
public static function getInstanceWithWidgetId($widgetId, $userId)
{
$db = PearDatabase::getInstance();
$result = $db->pquery('SELECT * FROM vtiger_module_dashboard_widgets
INNER JOIN vtiger_links ON vtiger_links.linkid = vtiger_module_dashboard_widgets.linkid
WHERE linktype = ? AND vtiger_module_dashboard_widgets.id = ? AND userid = ?', array('DASHBOARDWIDGET', $widgetId, $userId));
$self = new self();
if ($db->num_rows($result)) {
$row = $db->query_result_rowdata($result, 0);
if ($row['linklabel'] == 'Mini List') {
$minilistWidget = Vtiger_Widget_Model::getInstanceFromValues($row);
$minilistWidgetModel = new Vtiger_MiniList_Model();
$minilistWidgetModel->setWidgetModel($minilistWidget);
$row['title'] = $minilistWidgetModel->getTitle();
}
$self->setData($row);
}
return $self;
}