コード例 #1
0
ファイル: helper.php プロジェクト: alhitary/Board3-Portal
 /**
  * Assign module's template vars
  *
  * @param array $row Database row of module
  * @param mixed $template_module Template data as returned by module
  *
  * @return null
  */
 public function assign_module_vars($row, $template_module)
 {
     if (is_array($template_module)) {
         $this->template->assign_block_vars('modules_' . $this->portal_columns->number_to_string($row['module_column']), array('TEMPLATE_FILE' => $this->parse_template_file($template_module['template']), 'IMAGE_SRC' => $this->path_helper->get_web_root_path() . ltrim($this->root_path . 'styles/all/theme/images/portal/' . $template_module['image_src'], './'), 'TITLE' => $template_module['title'], 'CODE' => $template_module['code'], 'MODULE_ID' => $row['module_id'], 'IMAGE_WIDTH' => $row['module_image_width'], 'IMAGE_HEIGHT' => $row['module_image_height']));
     } else {
         $this->template->assign_block_vars('modules_' . $this->portal_columns->number_to_string($row['module_column']), array('TEMPLATE_FILE' => $this->parse_template_file($template_module), 'IMAGE_SRC' => $this->path_helper->get_web_root_path() . ltrim($this->root_path . 'styles/all/theme/images/portal/' . $row['module_image_src'], './'), 'IMAGE_WIDTH' => $row['module_image_width'], 'IMAGE_HEIGHT' => $row['module_image_height'], 'MODULE_ID' => $row['module_id'], 'TITLE' => isset($this->user->lang[$row['module_name']]) ? $this->user->lang[$row['module_name']] : utf8_normalize_nfc($row['module_name'])));
     }
 }
コード例 #2
0
ファイル: manager.php プロジェクト: alhitary/Board3-Portal
 /**
  * Get the horizontal move action (columns to move)
  *
  * @param array $module_data Array containing the module data
  * @param int $direction Direction to move; 1 for right, -1 for left
  *
  * @return int|null Move action if module can be moved, calls
  *		handle_after_move() if it can't be moved
  */
 public function get_horizontal_move_action($module_data, $direction)
 {
     if ($this->constraints_handler->can_move_horizontally($module_data, $direction)) {
         if ($this->module->get_allowed_columns() & $this->portal_columns->string_to_constant($this->portal_columns->number_to_string($module_data['module_column'] + $direction))) {
             return $direction;
             // we move 1 column
         } else {
             if ($this->module->get_allowed_columns() & $this->portal_columns->string_to_constant($this->portal_columns->number_to_string($module_data['module_column'] + $direction * 2)) && $module_data['module_column'] != $this->portal_columns->string_to_number('center')) {
                 return 2 * $direction;
                 // we move 2 columns
             }
         }
     }
     $this->handle_after_move(false);
 }
コード例 #3
0
ファイル: main.php プロジェクト: alhitary/Board3-Portal
 /**
  * Get module's template
  *
  * @param array $row Database row of module
  * @param object $module Module object
  *
  * @return mixed False if module is not inside possible columns or if
  *		module shouldn't be shown, otherwise module's template
  */
 public function get_module_template($row, $module)
 {
     $template_module = false;
     $column = $this->portal_columns->number_to_string($row['module_column']);
     // Make sure we should actually load this module
     if (!$this->display_module_allowed($this->portal_columns->string_to_constant($column))) {
         return false;
     }
     if ($this->is_enabled_side_column($column)) {
         ++$this->module_count[$column];
         $template_module = $module->get_template_side($row['module_id']);
     } else {
         if (in_array($column, array('top', 'center', 'bottom'))) {
             ++$this->module_count[$column];
             $template_module = $module->get_template_center($row['module_id']);
         }
     }
     return $template_module;
 }
コード例 #4
0
 /**
  * Check if module can be moved to desired column
  *
  * @param \board3\portal\modules\module_interface $module
  * @param string $column Column string
  *
  * @return bool True if module can be moved, false if not
  */
 public function can_add_module($module, $column)
 {
     return (bool) ($module->get_allowed_columns() & $this->portal_columns->string_to_constant($this->portal_columns->number_to_string($column)));
 }